⬅︎ Back to To readline() or readlines()
I just want to mention that what you probably want to do when reading a file line by line is this: (Taken from the File documentation of Python): f = open("hello.txt")try:..for line in f:....print linefinally:..f.close()xreadlines() is deprecated since release 2.3. The "for line in f" pattern is recommended.
Comment
I just want to mention that what you probably want to do when reading a file line by line is this: (Taken from the File documentation of Python):
f = open("hello.txt")
try:
..for line in f:
....print line
finally:
..f.close()
xreadlines() is deprecated since release 2.3. The "for line in f" pattern is recommended.