摘要: Python标准库Python标准库是随Python附带安装的。这些模块可以解决大部分的问题。1.sys模块:包含系统对应的功能。使用sys.args即命令行参数一下代码类似cat功能,命令参数为“--version”或“-help”时,打印相关说明;为文件时,打印其内容。 1 # Filename: cat.py 2 import sys 3 def readfile(filename): 4 '''Print a file to the standard output.''' 5 f = file(filename) 6 while True 阅读全文
posted @ 2012-03-18 22:06 Alex_Monkey 阅读(712) 评论(0) 推荐(0) 编辑