发布时间:2019-08-27 08:03:04编辑:auto阅读(1704)
import xlsxwriter workbook=xlsxwriter.Workbook('chart.xlsx') sheet1=workbook.add_worksheet('chart') bold=workbook.add_format() bold.set_bold() title=['kemu','ke1','ke2','ke3','ke4'] data=[['zhangsan',60,85,75,100],['lisi',78,89,67,30],['wangwu',77,66,89,98]] mychart = workbook.add_chart({'type':'column'}) sheet1.write_row('G1',title,bold) for i in range(len(data)): row=i+2 sheet1.write_row('G{}'.format(row),data[i]) mychart.add_series({'name':'=chart!$G${}'.format(row), 'categories':'=chart!$H$1:$L$1', 'values':'=chart!$H${}:$L${}'.format(row,row)}) mychart.set_title({'name':'this is a test'}) sheet1.insert_chart('G10',mychart) workbook.close()
上一篇: 工位上的Python——简单SSH服务器
下一篇: Python getopt模块函数用法小
47882
46450
37336
34773
29348
26011
24961
19979
19582
18076
5821°
6449°
5962°
5988°
7097°
5937°
5981°
6472°
6437°
7818°