兰丁特惹恼了我 [英] Randint annoys me

查看:42
本文介绍了兰丁特惹恼了我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我是python中的新手,我正在尝试创建一个使用随机的简单程序。当我在python程序中导入随机时,它顺利运行。但是,当我在脚本中导入它,然后使用print random.randint(1,6)时,它告诉我:模块对象没有属性''randint''。我应该做些什么呢?我的朋友坐在离我不到十英寸的地方,使用相同的脚本,它就像一个魅力。

解决方案


您好,我是python中的新手,我正在尝试创建一个使用随机的简单程序。当我在python程序中导入随机时,它顺利运行。但是,当我在脚本中导入它,然后使用print random.randint(1,6)时,它告诉我:模块对象没有属性''randint''。我应该做些什么呢?我的朋友坐在离我不到十英寸的地方,使用相同的剧本,它就像一个魅力。



我可以在这种情况下得到相同的消息:

展开 | 选择 | Wrap | 行号


< blockquote class =post_quotes>
您好,我是python中的新手,我正在尝试创建一个使用随机的简单程序。当我在python程序中导入随机时,它顺利运行。但是,当我在脚本中导入它,然后使用print random.randint(1,6)时,它告诉我:模块对象没有属性''randint''。我应该做些什么呢?我的朋友坐在离我不到十英寸的地方,使用相同的剧本,它就像一个魅力。



在这里发布代码(使用[code] TAGS)会非常有帮助。


真的不是很难。它由两行组成:

展开 | 选择 | Wrap | 行号


Hello, I am rather a newbie in python, and I''m trying to creawte a simple program that uses random. When I import random in the python program, it runs along smoothly. However, when I import it in a script, and then use print random.randint(1,6), it tells me: "module object has no attribute ''randint''". What in the blazes am I supposed to make of that? My friend is sitting not ten inches away from me, using the same script, and it works like a charm.

解决方案

Hello, I am rather a newbie in python, and I''m trying to creawte a simple program that uses random. When I import random in the python program, it runs along smoothly. However, when I import it in a script, and then use print random.randint(1,6), it tells me: "module object has no attribute ''randint''". What in the blazes am I supposed to make of that? My friend is sitting not ten inches away from me, using the same script, and it works like a charm.

I can get the same message in this scenario:

Expand|Select|Wrap|Line Numbers


Hello, I am rather a newbie in python, and I''m trying to creawte a simple program that uses random. When I import random in the python program, it runs along smoothly. However, when I import it in a script, and then use print random.randint(1,6), it tells me: "module object has no attribute ''randint''". What in the blazes am I supposed to make of that? My friend is sitting not ten inches away from me, using the same script, and it works like a charm.

Posting the code here (USING [code] TAGS) would be very helpful.


The scrip is not seriously difficult really. It consists of two lines:

Expand|Select|Wrap|Line Numbers


这篇关于兰丁特惹恼了我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆