Python读取Excel,并以字典形式写入json
需求:读取Excel,将数据拼接为双层嵌套dict
# -*- coding:utf-8 -*-
import xlrd
file = 'liaoningcun.xlsx'
def read_excel():
wb = xlrd.open_workbook(filename=file)#打开文件
sheet1 = wb.sheet_by_index(0)#通过索引获取表格
# 获取Excel对应列
CUNDM = sheet1.col_values(0)
CUNMC = sheet1.col_
原创
2020-08-20 14:17:39 ·
901 阅读 ·
0 评论