Created
March 12, 2020 14:14
-
-
Save akash-coded/eeb635814c07fd7d1d441cacffe5541d to your computer and use it in GitHub Desktop.
Try with resources, except when you can't and finally, make things work.
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('hshhj.txt', mode = 'r'): | |
print("File opened") | |
except FileNotFoundError as e: | |
print("Error opening file") | |
print(e) | |
finally: | |
print("Some operation independent of file contents") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment