mode | file exists | file does not exist | read | Write | stream location |
---|---|---|---|---|---|
r | read file content | mistake | √ | × | begin |
w |
Empty file contents | create | × | √ | begin |
a | keep original content | create | × | √ | begin/end |
r+ | Read and write file content | mistake | √ | √ | begin |
w+ | Empty file contents | create | √ | √ | begin |
a+ | keep original content | create | √ | √ | begin/end |
The mode of open() for Python file operations
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=324476123&siteId=291194637
Ranking