def xls(self):
from xlwt import Workbook
filename = self.filename_front + '.xls'
wb = Workbook(encoding='utf-8')
wb_sheet = wb.add_sheet("sheet1")
for title in self.title_list:
wb_sheet.write(0, self.title_list.index(title), title)
for line in self.query_set :
row_no = (self.query_set.index(line) + 1)
print(line)
col_no = 0
for column in line[1:] :
if col_no == len(line) - 2:
# 2016-10-17 15:21:33.348313+00:00
re.split('\.' , str(column))[0]
wb_sheet.write(row_no, col_no, column)
col_no += 1
# wb.write(?, ?, ??)
return filename
评论列表
文章目录