Last active
April 7, 2022 07:24
-
-
Save pointofpresence/71e988e3a17a7df44dd525387ec504fc to your computer and use it in GitHub Desktop.
Python exception while using 'with' statement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
with open( "a.txt" ) as f : | |
print f.readlines() | |
except EnvironmentError: # parent of IOError, OSError *and* WindowsError where available | |
print 'oops' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment