如果我这样做了:
print sh.cell(1,col)我得到了:
text:u''
text:u''
text:u'eng'
text:u''
xldate:41450.0
number:11.0
number:30.0
text:u'Reality TV'但是,如果我这样做:print type(sh.cell(1,col)),我会得到:
<class 'xlrd.sheet.Cell'>为了所有人。
如何从xlrd获取"text“、"xldate”或"number“--即单元格类型?
发布于 2013-06-29 04:51:02
您需要Cell对象的ctype属性。例如:
sh.cell(1,col).ctype这是一个指示单元格类型的整数。您希望与xlrd.XL_CELL_DATE;see documentation here进行比较。
发布于 2013-06-29 04:48:25
我使用了一种类似于黑客的方式:
if str(sh.cell(1,col)).split(':')[0] == 'xldate':https://stackoverflow.com/questions/17373308
复制相似问题