path = 'C:/Users/UESRDER/Desktop/'
file = "新建文本文档.txt"
src = os.path.join(os.path.abspath(path1),file)
#写入文件
with open(src,"w") as f:
f.write('hello!')
Python-with open() as f写入
最新推荐文章于 2024-05-29 19:55:05 发布
path = 'C:/Users/UESRDER/Desktop/'
file = "新建文本文档.txt"
src = os.path.join(os.path.abspath(path1),file)
#写入文件
with open(src,"w") as f:
f.write('hello!')