Skip to content

Instantly share code, notes, and snippets.

@bukakoding
Last active November 6, 2024 12:59
Show Gist options
  • Save bukakoding/1c5a1b8bd798f5cb4786a381adbb51f3 to your computer and use it in GitHub Desktop.
Save bukakoding/1c5a1b8bd798f5cb4786a381adbb51f3 to your computer and use it in GitHub Desktop.
Example of try-catch
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