Read a file line by line: Difference between revisions

Content added Content deleted
Line 3: Line 3:


=={{header|Python}}==
=={{header|Python}}==
For sthe simple case of iterating over the lines of a file you can do:
For the simple case of iterating over the lines of a file you can do:
<lang python>with open("foobar.txt") as f:
<lang python>with open("foobar.txt") as f:
for line in f:
for line in f: