写入文件代码如下:
with open("e:\test01.txt","w+",encoding="utf-8") as wq:
for i in range(1,10):
for j in range(1,i+1):
wq.write(str(j)+"*"+str(i)+"="+str(i*j)+" ")
wq.write(" ")