You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
511 B
38 lines
511 B
4 years ago
|
try:
|
||
|
import uos as os
|
||
|
except ImportError:
|
||
|
import os
|
||
|
|
||
|
if not hasattr(os, "remove"):
|
||
|
print("SKIP")
|
||
|
raise SystemExit
|
||
|
|
||
|
# cleanup in case testfile exists
|
||
|
try:
|
||
|
os.remove("testfile")
|
||
|
except OSError:
|
||
|
pass
|
||
|
|
||
|
# Should create a file
|
||
|
f = open("testfile", "a")
|
||
|
f.write("foo")
|
||
|
f.close()
|
||
|
|
||
|
f = open("testfile")
|
||
|
print(f.read())
|
||
|
f.close()
|
||
|
|
||
|
f = open("testfile", "a")
|
||
|
f.write("bar")
|
||
|
f.close()
|
||
|
|
||
|
f = open("testfile")
|
||
|
print(f.read())
|
||
|
f.close()
|
||
|
|
||
|
# cleanup
|
||
|
try:
|
||
|
os.remove("testfile")
|
||
|
except OSError:
|
||
|
pass
|