【Python】使用print函数打印文件

avatar

azurekiln

输出Hello World 到相对路径 file.txt 的文件中

print("Hello World", file=open("file.txt", "w"))

输出Hello World 到绝对路径 D:/file.txt 的文件中

print("Hello World", file=open("D:\\file.txt", "w"))

扫描二维码,在手机上阅读
收藏
请先 登录 再评论
powered by emlog pro
服务器供应商 景云数据

友情链接
白衣Ink


sitemap