AttributeError: 'module' object has no attribute 'randint'

来源:互联网 发布:淘宝仓库宝贝多久删除 编辑:程序博客网 时间:2024/05/01 01:29
i am a beginner, i tried to have python generate a random integer from 0 to 10
my code looks like this:

import random
number = random.randint(0,10)
print number

i am using python 2.7
it gives AttributeError: 'module' object has no attribute 'randint'

please help, thank you very much.
Oct 22 '11 #1
Post Reply

✓ answered by bvdet

I'll take a guess. You have anther file named "random.py" on the Python path that is read before the random module is reached.
0 0
原创粉丝点击