⚠️ Errors & Files
try / except
Catch errors instead of crashing.
Wrap risky code in try. Handle specific exception types in except. Use finally for cleanup that always runs.
try:
x = int("hello")
except ValueError as e:
print(f"Bad input: {e}")
finally:
print("done")