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.
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
✓ 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
- AttributeError: 'module' object has no attribute 'randint'
- AttributeError: 'module' object has no attribute 'getpass'
- AttributeError: 'module' object has no attribute 'Serial'
- AttributeError: 'module' object has no attribute(转)
- AttributeError: 'module' object has no attribute 'HAVE_DECL_MPZ_POWM_SEC'
- AttributeError: 'module' object has no attribute 'Serial'
- AttributeError: 'module' object has no attribute 'LabelMap'
- AttributeError: 'module' object has no attribute 'XXX'
- AttributeError: 'module' object has no attribute 'urlopen'
- AttributeError:'module' object has no attribute 'classify'
- AttributeError: ‘module’ object has no attribute’xxx’
- AttributeError: ‘module’ object has no attribute’ 问题
- AttributeError: 'module' object has no attribute 'VideoWriter_fourcc'
- AttributeError: 'module' object has no attribute 'AF_INET'
- AttributeError: 'module' object has no attribute 'VideoWriter_fourcc'
- AttributeError: 'module' object has no attribute '_base'
- AttributeError: 'module' object has no attribute 'best_partition'
- AttributeError: 'module' object has no attribute 'imsave'
- LeetCode: N-Queens II
- 编译原理之LR(0)分析算法的c实现
- nginx入门学习—— 在已安装好的nginx上添加nginx_upstream_check_module模块(三)
- centos 优先使用本地源
- Zepto源码分析之二~三个API
- AttributeError: 'module' object has no attribute 'randint'
- 怀疑点
- GPU的硬件结构
- typeid
- Github使用学习笔记
- 每隔5秒发一条新浪和腾讯微博的windows软件
- 顺序队列的入队,出队,遍历队列计算队列的长度
- apache本地配置多域名(wampserver本地配置多域名)
- uva 1378 - A Funny Stone Game sg博弈