Input loop: Difference between revisions

Content added Content deleted
(Input loop in various BASIC dialents)
Line 2,407: Line 2,407:


One can open a new stream for read and have it automatically close when done, with a new "with" statement:
One can open a new stream for read and have it automatically close when done, with a new "with" statement:
<lang python>from __future__ import with_statement
<lang python>#from __future__ import with_statement # is not needed in Python 3.6


with open(filename, 'r') as f:
with open(filename, 'r') as f: