衣带渐宽终不悔,为伊消得人憔悴
问题描述:
fw=open(r'C:\test.txt','w')
s="Hello World!"
fw.write(s)
==========
此时查看C盘根目录,发现test.txt文件已被创建,但是文件为空!
原因:
写入文件后未关闭文件!
fw.close()
Copyright @ 2024 skyhiter Powered by .NET 9.0 on Kubernetes Powered by: .Text and ASP.NET Theme by: .NET Monster