Python 對文件內容迭代 按行處理

def process(string):
    print 'Processing: ',string
f=open(r'D:\\ruanjian\\Python\\程序\\1.txt')
while True:
    line=f.readline()
    if not line:break
    process(line)
f.close()


Processing:  this isn't a haiku

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章