摘要: 函数篇: round() 四舍五入 abs() 求绝对值 math.floor() 向下取整 import math 调用math模块 #int()进行转换的时候 自动向下取整 math.ceil() 向上取整 from math import sqrt 直接从模块中调用函数 用sqrt()即可 可以直接将函数赋值给一个变量进行使用:foo=math.floor 直接使用foo()即可 cmath.sqrt()可对负数进行开方 负数的后缀为j python本身对python提供支持 str() repr()都能将值转化为字符串 str是一种类型 而repr是一个函数 str()将值转化为易.. 阅读全文
posted @ 2011-11-24 23:06 Crazy_yiner 阅读(2318) 评论(0) 推荐(0) 编辑
摘要: http://www.pugwoo.com/2010/02/10/pyinstaller.html1、安装PyInstallerPyInstaller的作用如标题所说,首先需要下载PyInstaller和UPX,UPX是用来压缩exe的,点击超链接下载吧,目前稳定版本是1.3,注意选择你使用的操作系统。如在Windows下,将下载解压后的upx.exe放到PyInstaller解压后的文件夹内。设PyInstaller的文件夹为D:\PyInstaller,下同。命令行下进入D:\PyInstaller,运行Configure.py,应该看到如下信息:I: computing EXE_depe 阅读全文
posted @ 2011-11-24 22:51 Crazy_yiner 阅读(9575) 评论(0) 推荐(0) 编辑
摘要: 转自:http://www.cnpython.org/123.html最近在做那个测试框架的时候发现 Python 的另一个获得系统执行命令的返回值和输出的类。最开始的时候用 Python 学会了 os.system() 这个方法是很多比如 C,Perl 相似的。os.system('cat /proc/cpuinfo')但是这样是无法获得到输出和返回值的,继续 Google,之后学会了 os.popen()。output=os.popen('cat /proc/cpuinfo')printoutput.read()通过 os.popen() 返回的是 file 阅读全文
posted @ 2011-11-24 22:47 Crazy_yiner 阅读(914) 评论(0) 推荐(0) 编辑
摘要: import osimport sysimport reos.system("Tasklist/SVC>w.txt")f=open(r"w.txt","r")s=f.read()exe1="QQ.exe"pat=exe1+r"\s+(\d+)"r=re.findall(pat,s)for rr in r: os.system("taskkill /f /pid "+rr) 阅读全文
posted @ 2011-11-24 22:46 Crazy_yiner 阅读(298) 评论(0) 推荐(0) 编辑