`
have_life
  • 浏览: 146883 次
社区版块
存档分类
最新评论

python 读文件

 
阅读更多
http://www.cnblogs.com/xuxn/archive/2011/07/27/read-a-file-with-python.html



# File: readline-example-3.py

file = open("sample.txt")

while 1:
    lines = file.readlines(100000)
    if not lines:
        break
    for line in lines:
        pass # do something
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics