输出乘法表到excel,输出乘法表excel,[Python]代码im


[Python]代码

import xlwtwbk=xlwt.Workbook()sheet1=wbk.add_sheet("my_sheet1")for i in range(1,10):    for j in range(1,i+1):        sheet1.write(i-1,j-1,"%sx%s=%s"%(j,i,j*i))wbk.save("C:/test.xls")print "Done!"'''for i in range(1,10):    for j in range(0,2*i,2):        sheet1.write(i-1,j,"%s * %s = "%(j/2+1,i))        sheet1.write(i-1,j+1,'%s'%((j/2+1)*i))'''

评论关闭