You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
514 B
Python
21 lines
514 B
Python
import machine, uos
|
|
|
|
# machine.SDCard(slot=1, width=1, cd=None, wp=None, sck=None, miso=None, mosi=None, cs=None)
|
|
|
|
sd = machine.SDCard()
|
|
|
|
uos.mount(sd, '/sd')
|
|
|
|
|
|
def cat(file, encoding='utf8'):
|
|
"""Prints the file."""
|
|
with open(file, mode='r', encoding=encoding) as f:
|
|
for line in f.readlines():
|
|
print(line)
|
|
|
|
|
|
def to_file(file, text='', encoding='utf8'):
|
|
"""Simple function to write some text to a file."""
|
|
with open(file, mode='r', encoding=encoding) as f:
|
|
f.write(text)
|