|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
random报错如下:请问大神们如何解决?
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> random.randint(1, 10)
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
random.randint(1, 10)
NameError: name 'random' is not defined
>>> x = random.getstate()
random.randint(1, 10)
SyntaxError: multiple statements found while compiling a single statement
>>>
本帖最后由 hrp 于 2020-10-7 21:50 编辑
首先你没有导入random模块,第一行加import random,其次交互模式不能同时输入多行代码运行,新建一个文件,F5运行
|
|