Reprint Please specify source: http://blog.csdn.net/l1028386804/article/details/47450667
"RT" Simply reads open a text file. Just agree to read the data
"WT" simply writes Open or creates a text file, agreeing only to write the data
"At" Appends open a text file and writes data at the end of the file
"RB" simply reads open a binary file. Just agree to read the data
"WB" simply writes open or create a binary file. Just agree to write the data
"AB" appends open a binary file and writes data at the end of the file
"rt+" read and write open a text file. Agree to read and write
"wt+" read/write open or create a text file. Consent to read and write
"at+" read and write open a text file. Agree to read, or append data at the end of the document
"rb+" read and write open a binary file, agreeing to read and write
"wb+" read/write open or create a binary file, agree to read and write
"ab+" reads and writes open a binary file. Agree to read, or append data at the end of the document
There are several explanations for how files are used:
How the file is used by R,w,a,t,b. + Six characters to spell, the meaning of each character is:
R (Read): Read
W (write): Write
A (append): Append
T (text): Literal file, can be omitted without writing
B (banary): binary file
C language--file operation mode