【发布时间】:2018-01-04 12:59:55
【问题描述】:
我必须在 Python 中获取一个 Int64 对象。我的代码如下所示:
from System import Int64
l = Int64.Parse('123')
print(l, type(l))
但它返回:123 <class 'int'>
当我对 DateTime c# 对象执行相同操作时,它返回了正确的类型:<class 'System.DateTime'>
那么为什么 Python 将 Int64 C# 对象转换回它自己的 int 类?
我正是需要这种类型,因为我将它发送到外部程序,否则会失败。
非常感谢。
【问题讨论】:
-
我不确定原生 python 中是否存在 int64。也许你想使用 numpy??
-
long(Int64) 是一个原语;我会 expect python 将其映射到它自己最接近的原语...?
标签: c# python types long-integer int64