Jan 2, 2013

Print File Content in Python


file = open("read.txt","r")
text = file.readlines()   #Reads the file content
file.close()

for line in text:
    print line        #Python 2.X Versions
    #print(line)      #Python 3.X Versions

No comments:

Post a Comment