【文件属性】:
文件名称:通过代码实例了解Python sys模块
文件大小:36KB
文件格式:PDF
更新时间:2020-12-16 18:39:03
模块
sys-系统特定的参数和功能
该模块提供对解释器使用或维护的一些变量的访问,以及与解释器强烈交互的函数。它始终可用。
代码如下
#!/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, # notic