求解:文件写入问题
with open('z.txt','w') as f:print(f.write("hello"))
在python中,我写入的是"hello",为什么不能输出"hello",而是输出5??
f = open('C:\\Users\\25448\\Desktop\\1.txt', 'w') f.write('hello') f.close() f1 = open('C:\\Users\\25448\\Desktop\\1.txt', 'r') print(f1.read()) f.close()