import time
time.sleep(0.1) # Wait for USB to become ready
# Read from words.txt
with open("words.txt", "r") as f:
content = f.read()
print(content)
print("----------")
# Open words.txt to add two lines
with open("words.txt", "a") as e:
e.write("banana\n")
e.write("mango\n")
# Read from words.txt
with open("words.txt", "r") as f:
content = f.read()
print(content)
print("----------")
# Open words.txt a write 2 lines
with open("words.txt", "w") as e:
e.write("carrot\n")
e.write("celery\n")
# Read from words.txt
with open("words.txt", "r") as f:
content = f.read()
print(content)
print("----------")