mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
22 lines
351 B
Python
22 lines
351 B
Python
try:
|
|
import os
|
|
import io
|
|
except ImportError:
|
|
exit(0)
|
|
|
|
a = open('123.txt', 'wt')
|
|
a.write('123')
|
|
a.write('456')
|
|
a.close()
|
|
|
|
with open('123.txt', 'rt') as f:
|
|
assert f.read() == '123456'
|
|
|
|
with open('123.txt', 'a') as f:
|
|
f.write('测试')
|
|
|
|
with open('123.txt', 'r') as f:
|
|
assert f.read() == '123456' + '测试'
|
|
|
|
os.remove('123.txt')
|