将输出写入文档
mytxt = open('out.txt', mode='a', encoding='utf-8') for i in range(10): print(i, file=mytxt) mytxt.close()