为什么我从 random.choice 属性收到错误,但我不使用 choice?



为什么我得到一个关于选择属性的错误,但我不使用选择?

这是我的python代码:
from random import randint
User, Computer = 0, randint(0,11)
# check process
while Computer != User:
User = int(input('Enter Your number :'))
print('Very good')
Error: 
in <module>
print(random.choice(a))    
AttributeError: partially initialized module 'random' has no attribute 'choice' (most likely due to a circular import)

我不知道为什么我得到这个错误。

在您的工作目录或源文件目录中是否有一个random.py文件?如果您创建了一个,它可能与库中的一个冲突。重命名后再试。

相关内容

最新更新