⚠️ Errors & Files
Reading & Writing Files
Use 'with open' for safe file I/O.
The with statement automatically closes the file when you're done — even if an error occurs.
with open("notes.txt", "w") as f:
f.write("hello\n")
with open("notes.txt") as f:
print(f.read())
The browser sandbox uses an in-memory filesystem — files don't persist across runs, but everything else works.