Learning immediately: https://edu.csdn.net/course/play/24797/282195?utm_source=blogtoedu
'' ' R & lt: read-only (file must be present) W: write the first empty (automatically creates a new file) A: additional content, the final content cursor (automatically creates a new file) +: write mode, may be mixed R & lt +: Read take and write, at the beginning of the cursor position (file must exist) W +: Clear after write (automatically creates a new file) A +: read and write, the end position of the cursor (automatically creates a new file) B: opened in binary mode, can mix t: text mode on '' '
open('test.txt', 'w') open('test.txt', 'w+') open('test.txt', 'r+') open('test.txt', 'r') open('test.txt', 'a+') open('test.txt', 'a')