Read a file line by line: Difference between revisions
Content added Content deleted
m (→{{header|Python}}: Whoops.) |
(→{{header|Python}}: Sp.) |
||
Line 3: | Line 3: | ||
=={{header|Python}}== |
=={{header|Python}}== |
||
For |
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: |