[issue46304] Unable to iterate over lines in a file without a block of code

Eric V. Smith report at bugs.python.org
Sat Jan 8 01:54:56 EST 2022


Eric V. Smith <eric at trueblade.com> added the comment:

Hi, Jason.

How about:

>>> from pathlib import Path
>>> Path("foo.txt").read_text().splitlines()
['how', 'now', 'brown', 'cow']

Not the most elegant thing, I'll admit.

----------
nosy: +eric.smith

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46304>
_______________________________________


More information about the Python-bugs-list mailing list