使用xlrd读取excel并返回json

2014-12-09 0 1,004
使用xlrd读取excel并返回json
# -*- coding: utf-8 -*-
import sys
import xlrd
import json

file = sys.argv[1]
#print(file)
data = xlrd.open_workbook(file)
table=data.sheets()[0]
nrows=table.nrows
#print(nrows)
ncols = table.ncols
#print(ncols)
returnData={}
for i in range(nrows ):
    returnData[i]=table.row_values(i)
returnJson=json.dumps(returnData)
print(returnJson)

遇见资源网 python 使用xlrd读取excel并返回json http://www.ox520.com/14913.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务