Created
February 22, 2021 01:00
-
-
Save leveled/f0f385c773b3bdc4094b7652ff641001 to your computer and use it in GitHub Desktop.
Try except finally example block in python
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: | |
| f = open("demofile.txt") | |
| f.write("Lorum Ipsum") | |
| except: | |
| print("Something went wrong when writing to the file") | |
| finally: | |
| f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment