Code:
#-*-Coding:utf-8-*-
__author__=' Comk '
ImportXlsxwriter
data_dict={
"1":[u "Zhang San", Max, -, -],
"2":[u "John Doe", -, About, the],
"3":[u "Harry", -, the, the]
}
L = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L","M", "N", "O", "P", "Q", "R", "S", "T", "U",\
"V", "W", "X", "Y", "Z"]
# Create files and tables
workbook = Xlsxwriter. Workbook (' demo.xlsx ')
Worksheet = Workbook.add_worksheet (' Student ')
# table Column width
Worksheet.set_column (' a:a ', -)
# Write Data
n =1
forKey,valueinchData_dict.items ():
x ="A"+ Str(N)
Worksheet.write (x, key)
foryinchValue:
x = l[int(Value.index (y)) +1] + Str(Key)
Worksheet.write (x, y)
n + =1
workbook.close ()
:
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/8E/AE/wKiom1jI3_DDLSyPAAAZaT2HeL8322.png-wh_500x0-wm_ 3-wmp_4-s_2934751529.png "title=" 22222222222222222.png "alt=" Wkiom1ji3_ddlsypaaazat2hel8322.png-wh_50 "/>
This article is from the "Sky Blue Star" blog, please be sure to keep this source http://jingkonglanxing.blog.51cto.com/1152128/1906837
Python Xlsxwriter write Excel cousin data