0
点赞
收藏
分享

微信扫一扫

python IO 保存两句话在文件中 文件名abc.txt

# 获得文件对象,写模式
f = open("abc.txt", "w", encoding="utf8")
# 保存数据
f.write("hello python")
f.write("\n")
f.write("pyhui")
# 关闭文件对象
f.close()

举报

相关推荐

0 条评论