Study Notes (15): 21 days clearance Python (Video Lesson only) - to open the file and buffer mode

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')
Published 25 original articles · won praise 4 · Views 601

Guess you like

Origin blog.csdn.net/happyk213/article/details/105199100