'r' - Open for reading only; place the file pointer at the beginning of the
file.
'r+' - Open for reading and writing; place the file pointer at the beginning
of the file.
'w' - Open for writing only; place the file pointer at the beginning of the
file and truncate the file to zero length. If the file does not exist,
attempt to create it.
'w+' - Open for reading and writing; place the file pointer at the beginning
of the file and truncate the file to zero length. If the file does not
exist, attempt to create it.
'a' - Open for writing only; place the file pointer at the end of the file.
If the file does not exist, attempt to create it.
'a+' - Open for reading and writing; place the file pointer at the end of
the file. If the file does not exist, attempt to create it.
文件读写方式归纳
最新推荐文章于 2024-01-15 16:20:33 发布