python-3.x - NameError:未定义全局名称 'long'

标签 python-3.x long-integer nameerror

我有一个 Python 版本 3.3.0,但我不知道为什么它不能让我在这里为 b 和 m 做很长时间...... 我试图在这里查找答案,但没有任何帮助...谢谢

我收到一个错误提示

NameError: global name 'long' is not defined


power = long(b) % long(m)

最佳答案

在 Python 3.x 中,使用 int 代替 long

来自 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.

关于python-3.x - NameError:未定义全局名称 'long',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14904814/

相关文章:

python-3.x - 使用 kafka 运行 Faust 会因 ConsumerStoppedError 崩溃

java - 使用 BufferedReader 从文件中读取 Long 和 String

Javascript - 字节数组长?

python - <键入 'exceptions.NameError' >

python - 输入()错误 - NameError : name '...' is not defined

python - NameError:全局名称 'TemplateNotFound' 未定义

python - pip3 psutil无法安装较新版本

python - 双星号错误: Invalid Syntax

Python - 检查列表的索引元素是否存在 - 最佳实践?

java - 在 Java 中比较 int 和 long 是否可以