Read a file line by line : File Readline : File PYTHON examples


PYTHON examples » File » File Readline »

 

Read a file line by line




file = open('test.txt')
while 1:
    line = file.readline()       # read line by line
    if not line: break
    print line,

file.close()
           
       



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo File
» File Readline