python Traceback (most recent call last):
File “”, line 1, in
NameError: name ‘raw_input’ is not defined
python
版本2.7 -> 版本3.0
输入与输出变化 :
1、输出 print
>>> print'hello,world'
File "<stdin>", line 1
print'hello,world'
^
SyntaxError: invalid syntax
>>> print 'hello, world'
File "<stdin>", line 1
print 'hello, world'
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print('hello, world')?
print函数
print’’ —改为–> print(‘hello,world’)
print('hello,world')
hello,world
2、输入函数
–>python
2.7版本 name = raw_input()
3.0版本 name = input()
name = raw_input()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'raw_input' is not defined
name = raw_input() ----改为–> name = input()
name = input()
123
>>> print(123)
123