请说出下面代码结果及原因,很easy。
说明:test.txt文件不存在
with open('test.txt','w+') as f: f.write('34') f.seek(0) f.write('12') f.seek(0) print(f.read())
输出结果及原因:
with open('test.txt','a+') as f: f.write('34') f.seek(0) f.write('12') f.seek(0) print(f.read())
输出结果及原因:
with open('test.txt','a+') as f: f.write('3456789') f.seek(2) f.truncate(3) f.write('12') f.seek(0) print(f.read())
输出结果及原因: