读取方式 覆盖写入 w追加写入 a 将print()输出到txt doc= open('path',w) print(var,file=doc) 转载于:https://www.cnblogs.com/rise0111/p/11563219.html