标签:style blog color sp for on 文件 div log
1,从管道读取文件
import fileinput for line in fileinput.input(): pass
import sys for line in sys.stdin: print line
2,逐行读取文件
for line in data: ... do stuff ...
line = data.readline() while line: # ... do stuff ... line = data.readline()
标签:style blog color sp for on 文件 div log
原文地址:http://www.cnblogs.com/yumtaoist/p/4149521.html