Bootstrap

python读取xlsx文件年月日变成数字_python读取excel,数字都是浮点型,日期格式是数字的解决办法...

excel文件内容:

1165892-20170623151455179-1362118361.png

读取excel:

copycode.gif

# coding=utf-8

import xlrd

import sys

reload(sys)

sys.setdefaultencoding('utf-8')

import traceback

class excelHandle:

def decode(self, filename, sheetname):

try:

filename = filename.decode('utf-8')

sheetname = sheetname.decode('utf-8')

except Exception:

print traceback.print_exc()

return filename, sheetname

def read_excel(self, filename, sheetname):

filename, sheetname = self.decode(filename, sheetname)

rbook = xlrd.open_workbook(filename)

sheet = rbook.sheet_by_name

;