Excel 日期时间对象使我的 Python 3.7 shell 崩溃
Excel datetime objects crash my Python 3.7 shell
我正在使用 xlwings 库对某些 excel 工作表进行简单操作。
出于某种原因,我的 shell 不允许我读取 Excel 日期时间对象的值。
例如,调用 L2 中的值(第 2 行,第 12 列)将使我的 Python 3.7 shell 崩溃并重新启动它:
#setup
import xlwings as wing
mybook = wing.Book("some_sheet.xlsx")
mysheet = book.sheets['Sheet 1']
# the line of code that crashes my shell (picture of excel sheet included)
mysheet.range(2,12).value #row 2, column 12
我试过将值转换为文本,但这给出了奇怪的 5 数字字符串(可能可行)。
我已经尝试在其他地方寻找解决方案。
任何人都可以指出我在 Python 中使用这些 Excel 日期时间值的正确方向吗?
降级到 Python 3.6 为我解决了这个问题。
安装'pip install pywin32==300'
问题已解决
我正在使用 xlwings 库对某些 excel 工作表进行简单操作。 出于某种原因,我的 shell 不允许我读取 Excel 日期时间对象的值。
例如,调用 L2 中的值(第 2 行,第 12 列)将使我的 Python 3.7 shell 崩溃并重新启动它:
#setup
import xlwings as wing
mybook = wing.Book("some_sheet.xlsx")
mysheet = book.sheets['Sheet 1']
# the line of code that crashes my shell (picture of excel sheet included)
mysheet.range(2,12).value #row 2, column 12
我试过将值转换为文本,但这给出了奇怪的 5 数字字符串(可能可行)。 我已经尝试在其他地方寻找解决方案。
任何人都可以指出我在 Python 中使用这些 Excel 日期时间值的正确方向吗?
降级到 Python 3.6 为我解决了这个问题。
安装'pip install pywin32==300'
问题已解决