如果我做:
print sh.cell(1,col)
Run Code Online (Sandbox Code Playgroud)
我明白了:
text:u''
text:u''
text:u'eng'
text:u''
xldate:41450.0
number:11.0
number:30.0
text:u'Reality TV'
Run Code Online (Sandbox Code Playgroud)
但是,如果我这样做print type(sh.cell(1,col)),我得到:
<class 'xlrd.sheet.Cell'>
Run Code Online (Sandbox Code Playgroud)
对全部.
我如何从xlrd获得"text"或"xldate"或"number" - 即单元格类型?
您需要对象的ctype属性Cell.例如:
sh.cell(1,col).ctype
Run Code Online (Sandbox Code Playgroud)
这是一个表示单元格类型的整数.你想比较xlrd.XL_CELL_DATE; 看到这里的文档.
| 归档时间: |
|
| 查看次数: |
2515 次 |
| 最近记录: |