Created
August 6, 2023 22:30
-
-
Save Franck1333/642a6cd0345f3886c64f6e60d012d142 to your computer and use it in GitHub Desktop.
Gestion des Exceptions (Erreurs) PYTHON
This file contains 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
#ROCHAT_FRANCK | |
#Gestion des exceptions dans une fonction standard ; sans indication du type d'exption à gérer. | |
def fonctionUNE(): | |
try: | |
numeroUNO = 1 | |
#numeroUNO = 1 + a | |
print(numeroUNO) | |
except: | |
print("petite erreure...") | |
else: | |
print("Block else, executé uniquement si aucune erreur n'est produite") | |
finally: | |
print("Block finally, toujours executé avec ou sans erreur") | |
return 0 | |
if __name__ == "__main__": | |
fonctionUNE() | |
#Gestion des exceptions dans une fonction standard ; sans indication du type d'exption à gérer. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment