标签:读取 file sys turn sys.argv while imp 大小 pen
#!/usr/bin/env python
import os
import sys
def read_file(fpath):
Block_Size = 1024
with open(fpath,"r") as f:
while True:
block = f.read(Block_Size)
if block:
yield block
else:
return
for i in read_file(sys.argv[1]):
print(i)
标签:读取 file sys turn sys.argv while imp 大小 pen
原文地址:http://www.cnblogs.com/chengd/p/7100811.html