// txt_path
txt_path ='./text.txt'
//打开txt文件,写入模式(会覆盖原有内容)
txt = open(txt_path,'w')
i=5
txt.write(f"the is a print:{i}.\n")
txt.close()
python常量加变量写入txt文件
最新推荐文章于 2024-05-23 11:41:07 发布
// txt_path
txt_path ='./text.txt'
//打开txt文件,写入模式(会覆盖原有内容)
txt = open(txt_path,'w')
i=5
txt.write(f"the is a print:{i}.\n")
txt.close()