Python read函数
open(file, mode='r', buffering=- 1, encoding=None, errors=None, newline=None, closefd=True, opener=None)
其中关于模式参数的说明见如下表格:
参数 | 含义 |
---|---|
r | 以文本读模式打开(默认) |
w | 以文本写模式打开 |
x | 以创建模式打开,若文件存在则报错 |
a | 以写模式打开,若文件存在则追加到文件的末尾 |
b | 以二进制模式打开 |
t | 以文本模式打开(默认) |
+ | 打开以更新(以读写模式打开) |
详细信息请见:https://docs.python.org/3/library/functions.html#open