Best use of "open" context manager

2QdxY4RzWzUUiLuE at potatochowder.com 2QdxY4RzWzUUiLuE at potatochowder.com
Sat Jul 6 07:09:45 EDT 2024


On 2024-07-06 at 11:49:06 +0100,
Rob Cliffe via Python-list <python-list at python.org> wrote:

> Is there a better / more Pythonic solution?

https://docs.python.org/3/library/fileinput.html

At least this attempts to abstract the problem of iterating over a file
(or multiple files) into a library routine.  I've used it a little, but
I don't know the full depths of your use case and/or requirements.

HTH,
Dan


More information about the Python-list mailing list