Python random模块
random报错如下:请问大神们如何解决?Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) 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运行
页:
[1]