1. 程式人生 > >九九乘法表python3寫入檔案中

九九乘法表python3寫入檔案中

 

寫入檔案程式碼如下:

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("\n")