NameError: global name 'long' is not defined

纵然是瞬间 提交于 2019-12-20 10:21:15

问题


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

im getting an error saying

NameError: global name 'long' is not defined


power = long(b) % long(m)

回答1:


In Python 3.x, use int instead of long.

From What’s New In Python 3.0, Integers:

  • PEP 237: Essentially, long renamed to int. That is, there is only one built-in integral type, named int; but it behaves mostly like the old long type.


来源:https://stackoverflow.com/questions/14904814/nameerror-global-name-long-is-not-defined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!