File Handling in Python (Reading, Writing, CSV & JSON)
File handling in Python uses open(filename, mode) to read ('r'), write ('w', which erases existing content), or append ('a') to a file — always wrapped in a with statement so the file closes automatically, even if an error occurs.
