[Tutor] Using 'with open' statementfor reading a file two lines at a time
Ken Green
beachkidken at gmail.com
Thu Nov 26 19:37:08 EST 2020
Gentlemen and ladies:
I am using 'with open' statement to read a file two lines at a time and
then combining them together to print the results into another file. I
can read the first two lines, combine them and print the result into
another file and then that is it. Just the first and second lines were
printed and save.
How can I continue reading the third and fourth lines and so forth on
until the end of the file?
I am using Python 3.8.5 under Ubuntu 20.04.1 with using Thonny 3.3.0
(2020-11-5) as an interface. I used to use Geany but discovered the
latest version doesn't work in Ubuntu 20.04 and it only applicable for
Windows and Apple and there is no Linux version according to its website.
Thanking you all in advance,
Ken
More information about the Tutor
mailing list