第一次在 VS Code 中使用 Python。我的导入未被识别,即随机?
我已经在 Anaconda Jupyter 中运行了我的代码,所以我知道我的代码有效。是配置问题。
import random
num = random.randint(1,2)
我希望没有运行时错误。
但我在控制台中得到以下响应:
num = random.randint(1,2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'random' is not defined
慕莱坞森
相关分类