FDs will be closed after exception automatically in python2.7?
D'Arcy Cain
darcy at VybeNetworks.com
Mon Jun 10 11:11:14 EDT 2019
On 2019-06-10 10:48, Michael Torrie wrote:
> Probably you should be using Python 3, which uses a print() function.
> But even in Python 2.7, the recommended way to do this is like this:
>
> fd = open("file","w+")
> with fd:
There is still a small window there if there are asynchronous events
happening. Use this instead:
with open("file","w+") as fd:
*rest of good advice elided.*
--
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:darcy at Vex.Net VoIP: sip:darcy at VybeNetworks.com
More information about the Python-list
mailing list