Re: Best use of "open" context manager
Liste des Groupes
Revenir à cl python
Sujet :
Re: Best use of "open" context manager
De :
sjeik_appie (at) *nospam* hotmail.com (Albert-Jan Roskam)
Groupes :
comp.lang.python
Date :
12. Jul 2024, 11:30:14
Autres entêtes
Message-ID :
<mailman.33.1720776627.2981.python-list@python.org>
References :
1
2
Or like below, although pylint complains about this: "consider using
with". Less indentation this way.
f = None
try:
f = open(FILENAME)
records = f.readlines()
except Exception:
sys.exit(1)
finally:
if f is not None:
f.close()
Date
Sujet
#
Auteur
12 Jul 24
Re: Best use of "open" context manager
2
Albert-Jan Roskam
12 Jul 24
Re: Best use of "open" context manager
1
Stefan Ram
Haut de la page
Les messages affichés proviennent d'
usenet
.
NewsPortal