标签:div cme index ocs xxx pre excel表格 book 直接
1 def write_excels(self, document): 2 outwb = openpyxl.Workbook() 3 outws = outwb.create_sheet(index=0) 4 for y, docs in enumerate(document): 5 key = [doc for doc in docs] 6 for x, ky in enumerate(key): 7 outws.cell(y + 1, x + 1).value = docs[ky] 8 outwb.save("xxx.xlsx")
docment 为list对象 大致格式如下
1 docment = [{"a":1,"b":2},{"a":3,"b":4}]
存入Excel的样式如下:
1 , 2
3, 4
标签:div cme index ocs xxx pre excel表格 book 直接
原文地址:https://www.cnblogs.com/ltn26/p/10333840.html