题目描述
输出九九乘法口诀表到文件 E:/python/1.txt
中。
import os
filename="E:/python/1.txt"
fileobj=open(filename,"w")
for i in range (1,10):
for j in range(1,i+1):
ss=str(j)+"×"+str(i)+"="+str(j*i)+" "
fileobj.write(ss+" ")
if j==i:
fileobj.write("\n")
fileobj.close()