📚 › Python: the friendliest first language
12. Reading and writing files
open() opens a file. Use with open(...) as f so the file closes automatically. f.write() writes text, and f.read() reads the whole file.
Use "w" to write (replacing the file), "a" to add to the end, and "r" to read.
Show example
with open("notes.txt", "w") as f:
f.write("Hello file")
✍️ Your turn
Make a list words holding Hi and Python, then print them joined with one space.