r read-only , r+ read- write, do not create
w new write-only , w+ new read-write , both willcontent to zero
(Open in w mode, cannot read. w+ can read and write)
The difference between w+ and r+:
r+: readable and writable, if the file does not exist, an error is reported; w+: readable and writable, if the file does not exist, create
The difference between r+ and a+:
r+ overwrite, a+append
Open the file in a, a+ mode, and open it in additional mode
( a : open for additional writing , not readable; a+ : open for additional reading and writing )
Unreadable open with : w and a
Open methods that create new files if they do not exist: a, a+, w, w+
Open the file in a mode, and the middle is at the end. To read the file at this time, you need to point the pointer to the beginning seek(0)