1.sys模块 import sys sys.path()#打印系统path sys.version()#解释程序版本信息 sys.platform()#系统平台 sys.exit(0)#退出程序 command=sys.argv[1]#从程序外部获取参数 sys.stdout.write('#')#与print相同,区别是刷进缓存 # 例子 import time for i in range(10): sys.stdout.write('#') time.sleep(1) sys.stdou…
#!/usr/bin/python # Filename: cat.py import sys def readfile(filename): '''Print a file to the standard output.''' f = file(filename) while True: line = f.readline() if len(line) == 0: break print line, # notice comma f.close() # Script starts from h…