大文件建議用readlines ,從文件讀取每一行,
with open('/tmp/log','r') as file:
for line in file.readlines():
print line.strip()
小文件用read()
with open('/tmp/log','r') as file:
print file.read()
大文件建議用readlines ,從文件讀取每一行,
with open('/tmp/log','r') as file:
for line in file.readlines():
print line.strip()
小文件用read()
with open('/tmp/log','r') as file:
print file.read()
class MetaCls(type): def __new__(cls, *args, **kwargs): print("in MetaCls") # return super(Meta