NameError:全局名称"long"未定义 [英] NameError: global name 'long' is not defined
本文介绍了NameError:全局名称"long"未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Python版本3.3.0,但我不确定为什么它不能让我对b和m进行长时间操作... 我试图在这里查找答案,但是没有帮助...谢谢
I have a Python version 3.3.0 and I am not sure why it does not let me do long for b and m here... I tried to look up the answers on here and but nothing helped...thanks
我说错了
NameError: global name 'long' is not defined
power = long(b) % long(m)
推荐答案
在Python 3.x中,使用int
代替long
.
In Python 3.x, use int
instead of long
.
- PEP 237 :本质上,
long
重命名为int
.也就是说,只有一个内置的整数类型,名为int
;但它的行为主要是 就像旧的long
类型.
- PEP 237: Essentially,
long
renamed toint
. That is, there is only one built-in integral type, namedint
; but it behaves mostly like the oldlong
type.
这篇关于NameError:全局名称"long"未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文