open()
fi = open("关山月.txt","r")fo = open("关山月-诗歌.txt","w")
g = fi.read().split("。")
for a in g:
fo.write(a+"\n")
fo.seek(0)
b = fo.read()#这里有问题
print(b)
fi.close()
fo.close()
怎么改?
fi = open("关山月.txt","r")
fo = open("关山月-诗歌.txt","w")
fo . write(fi . read())
fi . close()
fo . close()
fi = open("关山月-诗歌.txt")
print(fi . read())
fi . close() w模式打开文件不可读,试试w+
页:
[1]