import os

//Read file
with open('/sd/FileName.*','r') as fs:

//Write file
with open('/sd/test.txt','w+') as fs:
  fs.write('Hello World')

//File read and write mode
w is opened for writing,
w+ open in read-write mode
r open in read mode
r+ open in read-write mode
a Open in append mode

//Set the file cursor

//View catalog

//Determine whether the path is a file
os.stat('/sd/FilePath')[0] == 0x8000)

//Determine whether the path is a directory
os.stat('/sd/DirectoryPath')[0] == 0x4000)

//Determine whether the file exists in the specified directory
'FileName.*' in os.listdir('/sd/DirectoryPath')
On This Page