|

楼主 |
发表于 2017-4-11 16:43:07
|
显示全部楼层
#创建excel文件,并按列导入
#C:\Users\Administrator\Desktop
# -*- coding: utf-8 -*-
def writer_excel():
f = xlwt.Workbook(encoding = 'utf-8')#创建工作簿
sheet = f.add_sheet('jzg')
row0 = [u'人次',u'时间']
column0 = column
colimn1 = m2
#生成第一行
for i in range(0,len(row0)):
sheet.write(0,i,row0[i])
#生成第一列
i,j = 1,0
while i < len(column0) and j < len(column0):
sheet.write_merge(i,i+1,0,0,column0[j])
i += 1
j += 1
#生成第二列
i= 0
while i <len(column0):
for j in ranger(0,len(column1)):
sheet.write(j+i+1,1,column[j])
i += 1
f.save('jzg.xls')
你能帮我看看我这出了什么问题吗,为什么我运行就是不能创建文件呢 |
|