• python之文件操作的几种模式总结


          文件操作的几种模式:

    "w"                             #write ,清空写,生成一个新的文件,写入内容,覆盖原文件
    "w+"                           #write and read ,先清空文件,然后写入内容,最后才能读取写入的内容
    "wb"                           #write binary #,b表示二进制模式读写
    "r"                              #read ,只读
    "rb"                            #read binary ,b表示二进制模式读写
    "r+"                             #read and write ,不清空原文件内容,可以同时读和写,从文件的开头写入
    "a"                             #append ,追加写,写在原文件的后面,从文件的结尾写入
    "ab"                           #append binary ,b表示二进制模式读写
    "a+"                          #append and read ,追加写,写在原文件的后面,从文件的结尾写入

  • 相关阅读:
    Codeforces Round #534 (Div. 2) D. Game with modulo 交互题
    传球游戏 dp
    欧拉通路和欧拉回路
    HDU 1116
    HDU 4970
    HDU 4557
    HDU 4864
    HDU 1565
    HDU 3046
    HDU 4240
  • 原文地址:https://www.cnblogs.com/whitemouseV2-0/p/10130742.html
Copyright © 2020-2023  润新知