Read a file line by line: Difference between revisions

m
(→‎{{header|Tcl}}: Add Python.)
Line 2:
The task is to demonstrate how to read a file line by line (as opposed to [[Read entire file|reading the entire file]]).
 
=={{header|PythoPython}}==
For sthe simple case of iterating over the lines of a file you can do:
<lang python>with open("foobar.txt") as f:
Anonymous user