import os
// Read file
with open('/sd/FileName.*', 'r') as fs:
print(fs.read())
// Write file
with open('/sd/test.txt', 'w+') as fs:
fs.write('Hello World')
// File read/write modes
w Open for writing,
w+ Open for reading and writing
r Open for reading
r+ Open for reading and writing
a Open for appending
// Set file cursor
fs.seek(0)
// View directory
os.listdir('/sd/DirectoryPath')
// Check if path is a file
os.stat('/sd/FilePath')[0] == 0x8000)
// Check if path is a directory
os.stat('/sd/DirectoryPath')[0] == 0x4000)
// Check if file exists in specified directory
'FileName.*' in os.listdir('/sd/DirectoryPath')