2010年12月25日 星期六

[Python] 逐行顯示檔案內容 read file line by line

f = open('C:\test.txt')
for l in f:
    print(l.strip())

Reference:

http://docs.python.org/library/stdtypes.html#str.strip
http://maestric.com/doc/python/misc
Related Posts Plugin for WordPress, Blogger...