Files are an essential part of working with computers, thus using Python to write to and read from a file are basic skills that you need to master. In this article, I’ll show you how to do the things you came here for, e.g.:
- How to open a file in Python
- Reading a file with Python (both at once or line-by-line)
- Writing to a file with Python
- Copy, move, rename, and delete files
When working with files, there will come that point where you need to know about file modes and permissions. I included an explanation on this topic as well, in case you need it.
The the full article in the free Python Land tutorial: How To Open, Read, Write Files with Python