导入随机时的AttributeError

Rev*_*v22 -2 python random import attributeerror

我有一些问题导入随机到我的python程序.我已经阅读了关于这个主题的其他主题,而对于其他主题,它似乎源于文件名为random.py.

我的文件名不是random.py.我使用print(随机.文件)来查看它从哪里导入,它似乎是从C:\ Python27\lib\random.pyc导入

我已经尝试将该文件移出文件夹,但它仍然无法正常工作.

这是错误:

Traceback (most recent call last):
  File "C:/Python27/Projects/Test.py", line 4, in <module>
    r1 = random.randomint(20,400)
AttributeError: 'module' object has no attribute 'randomint'
Run Code Online (Sandbox Code Playgroud)

我还在powershell和解释器中进行了测试.

这是代码片段:

import random
import getpass

r1 = random.randomint(20,400)
r2 = random.randomint(20,400)
p = getpass.getpass(prompt='Please enter the correct value: %d * %d: ' %(r1,r2))

if p == (r1*r2):
    print "Correct"
else:
    print "Incorrect"
Run Code Online (Sandbox Code Playgroud)

谁能帮我吗?

编辑:我是个白痴.谢谢.

Ash*_*ary 10

正确的功能名称random.randint不是random.randomint.