Last active
November 6, 2024 12:59
-
-
Save bukakoding/1c5a1b8bd798f5cb4786a381adbb51f3 to your computer and use it in GitHub Desktop.
Example of try-catch
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
try: | |
conn = mysql.connector.connect( | |
host="root", | |
user="myuser", | |
password="mypassword" | |
) | |
except Exception as e: | |
print("cannot connect database", e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment