您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

Python xlrd读为字符串

5b51 2022/1/14 8:22:57 python 字数 1658 阅读 577 来源 www.jb51.cc/python

在xlrd中从Excel读取特定单元格值时遇到困难.正在读取的值(日期值)正在转换为一个数字.我知道有解决方案将其转换成 python日期格式,但是可以直接读取xlrd中的字符串值吗? xlrd不将日期转换为float. Excel将日期存储为浮点数. 报价从the xlrd documentation(向下滚动一页): Dates in Excel spreadsheets In reality

概述

报价从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访问的教程

总结

以上是编程之家为你收集整理的Python xlrd读为字符串全部内容,希望文章能够帮你解决Python xlrd读为字符串所遇到的程序开发问题。


如果您也喜欢它,动动您的小指点个赞吧

除非注明,文章均由 laddyq.com 整理发布,欢迎转载。

转载请注明:
链接:http://laddyq.com
来源:laddyq.com
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。


联系我
置顶