这是我到目前为止所得到的:
counter = (0)
loop = 1
while loop ==1:
a = open ("mustangused.txt", "w")
counter = (str(counter)+str(1))
a.write (counter)
loop = 1
我想做它,这样它就会计算你通过 theis 循环的次数并在 .txt 文档中打印文本。
上面的代码有点工作,但问题是它只会将数字添加到以前的数字,如 12345,而不替换旧数字:( 我尝试了 w.write,但没有奏效。