1、r
data = open('Sun Wukong','r',encoding = 'utf-8').read()
print(data)
#This operation is a read operation of the file,
2、w
f = open('Sun Wukong','w',encoding = 'utf-8')
f.write('hello world')
f.write('karen') #Write two lines without wrapping, without overwriting ==>hello worldkaren
#This operation is a write operation of the file, overwriting the original content and re-editing
f = open('Sun Wukong 2','w',encoding = 'utf-8')
f.write('hello world')
#You can also create a new file for writing
3. f = open('Sun Wukong','a',encoding = 'utf-8')
f.append('hello world')
#Continue editing without affecting the original content
4、
impor time; time.sleep(50) #Delay buffer
open() to open a file
f.fileno() file descriptor
f.close() closes the file