Skip to main content
 首页 » 编程设计

python之Python 2.7 中的类型转换

2025年05月04日20xing901022

如何在 Python 2.7 中将 float 转换为 long?

我在 Python 2.3 中也这样做:

from array import* 
data = array('L',[12.34]) 
print data 

打印出:

array('L',[12L]) 

如何在 Python 2.7 中执行相同的操作?

请您参考如下方法:

大概是这样的?

>>> long(12.34) 
12L