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