python读取浮点数和读取文本文件示例

yipeiwu_com6年前
从文本文件中读入浮点数据,是最常见的任务之一,python没有scanf这样的输入函数,但我们可以利用正规表达式从读入的字符串中提取出浮点数 复制代码 代码如下:import refp...

python生成指定尺寸缩略图的示例

yipeiwu_com6年前
python生成指定尺寸的缩略图 复制代码 代码如下:def MakeThumb(path, sizes=(75, 32, 16)):    """&nbs...

Python FTP操作类代码分享

yipeiwu_com6年前
复制代码 代码如下:#!/usr/bin/py2# -*- coding: utf-8 -*-#encoding=utf-8 '''''    ftp自动下...

Python获取远程文件大小的函数代码分享

yipeiwu_com6年前
复制代码 代码如下:def getRemoteFileSize(url, proxy=None):    """ 通过content-length头获取远程...

Python自动化测试工具Splinter简介和使用实例

yipeiwu_com6年前
Splinter 快速介绍官方网站:http://splinter.cobrateam.info/官方介绍:Splinter is an open source tool for tes...

Python random模块(获取随机数)常用方法和使用例子

yipeiwu_com6年前
random.randomrandom.random()用于生成一个0到1的随机符点数: 0 <= n < 1.0 random.uniformrandom.uniform(...

Python getopt模块处理命令行选项实例

yipeiwu_com6年前
getopt模块用于抽出命令行选项和参数,也就是sys.argv命令行选项使得程序的参数更加灵活。支持短选项模式和长选项模式例如  python scriptname.py -...

Python中的jquery PyQuery库使用小结

yipeiwu_com6年前
pyquery库是jQuery的Python实现,可以用于解析HTML网页内容,使用方法:复制代码 代码如下:from pyquery import PyQuery as pq1、可加载...

Python中os和shutil模块实用方法集锦

yipeiwu_com6年前
复制代码 代码如下:# os 模块os.sep 可以取代操作系统特定的路径分隔符。windows下为 '\\'os.name 字符串指示你正在使用的平台。比如对于Wi...

python中xrange和range的区别

yipeiwu_com6年前
range 函数说明:range([start,] stop[, step]),根据start与stop指定的范围以及step设定的步长,生成一个序列。range示例:复制代码 代码如下...