import os
print('Current Working Directory:')
print(os.getcwd())
print('Root directory contents:')
files = os.listdir('/')
for file in files:
print(file)
print('/dev directory contents:')
files = os.listdir('/dev')
for file in files:
print(file)
print('Create a file, read the file and print the contents:')
f = open('testfile.txt', 'w')
f.write('Hello PyScript World')
f.close()
f = open('testfile.txt', 'r')
print(f.read())
f.close()
print('Create a file, read the file and print the contents:')
with open('testfile.txt', 'w') as f:
f.write('Hello PyScript World')
with open('testfile.txt', 'r') as f:
print(f.read())