Writing files in Python — text, CSV, JSON with native tools
KDnuggets guide to file I/O in Python: open(), write(), append() for text, CSV, and JSON formats using only the standard library.
• Text files: write mode ('w') overwrites, append mode ('a') adds to end
• CSV handling via csv module (reader/writer objects)
• JSON encode/decode with json.dump() and json.load()
• Context managers (with statement) auto-close file handles