| 
                         在xlrd中从Excel读取特定单元格值时遇到困难.正在读取的值(日期值)正在转换为一个数字.我知道有解决方案将其转换成 
 python日期格式,但是可以直接读取xlrd中的字符串值吗?
 解决方法
 xlrd不将日期转换为float. Excel将日期存储为浮点数. 
  
 报价从the xlrd documentation(向下滚动一页):  
  
  
  Dates in Excel spreadsheets  
  In reality,there are no such things.  What you have are floating point  numbers and pious hope. There are  several problems with Excel dates:  
  (1) Dates are not stored as a separate  data type; they are stored as floating  point numbers and you have to rely on  (a) the “number format” applied to  them in Excel and/or (b) knowing which  cells are supposed to have dates in  them. This module helps with (a) by  inspecting the format that has been  applied to each number cell; if it  appears to be a date format,the cell  is classified as a date rather than a  number.  
   
 另请参阅Cell类的部分,以及提取单元格类型(文本,数字,日期,布尔等)的各种Sheet方法.  
 还可以阅读可从www.python-excel.org访问的教程                         (编辑:莱芜站长网) 
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! 
                     |