python print'hello' File "<stdin>",line 1 print 'hello' SyntaxError:invalid syntax
2013-07-01 10:31
776 查看
python print'hello' File "<stdin>",line 1 print 'hello' SyntaxError:invalid syntax
刚开始看Python,照着书上些了个hello,结果错误:
>>> print 'hello'
File "<stdin>", line 1
print 'hello'
^
SyntaxError: invalid syntax
查看3.0文档:http://docs.python.org/release/3.0.1/whatsnew/3.0.html,发现从3.0开始print改成了
print()。文档是这样写的:The print statement has been replaced with a print() function,
with keyword arguments to replace most of the special syntax of the old print statement (PEP
3105).
print语句被print()方法代替,旧print语句中的特定的语法被参数代替。
所以呢,hello world!应该写成这样:print ("hello world!")
欢迎访问个人博客:http://zhangxichuan.science
刚开始看Python,照着书上些了个hello,结果错误:
>>> print 'hello'
File "<stdin>", line 1
print 'hello'
^
SyntaxError: invalid syntax
查看3.0文档:http://docs.python.org/release/3.0.1/whatsnew/3.0.html,发现从3.0开始print改成了
print()。文档是这样写的:The print statement has been replaced with a print() function,
with keyword arguments to replace most of the special syntax of the old print statement (PEP
3105).
print语句被print()方法代替,旧print语句中的特定的语法被参数代替。
所以呢,hello world!应该写成这样:print ("hello world!")
欢迎访问个人博客:http://zhangxichuan.science
相关文章推荐
- python print'hello' File "<stdin>",line 1 print 'hello' SyntaxError:invalid syntax
- Python---File "<stdin>", line 1 SyntaxError: invalid syntax
- File "<stdin>", line 1 pip install XXXXX ^ SyntaxError: invalid syntax
- python d:\test.py File "<stdin>", line 1 python d:\test.py ^ SyntaxError: invalid syntax
- Python 运行 Python hello.py 出错,提示: File "<stdin>" , line 1
- 第一个Python程序hello.py提示出现File "<stdin>",line 1错误
- Python学习第一个程序:python第一个程序hello.py提示出现File "<stdin>",line 1错误
- 写了一个hello.py,运行出错,提示 File "<stdin>" , line 1
- python 3.4.0 简单的print 'hello world',出错--SyntaxError: invalid syntax
- 运行程序,首次运行出现“File{"<stdin>".line1,error}
- 写了一个hello.py,运行出错,提示 File "<stdin>" , line 1
- python {File "<stdin>", line 1} error
- Python print "hello world" SyntaxError: invalid syntax
- [Python] example-one File"<stdin>",line 1错误
- 运行hello.py出错,提示 File "<stdin>" , line 1
- Windows编译Nodejs时遇到 File "configure", line 313 SyntaxError: invalid syntax Failed to create vc project files. 时的解决方法
- 'filename.h' file not found with <angled> include, use "quotes" instead. 问题详解
- File "<stdin>" , line 1
- File "scripts/rule_bison.py", line 75, in <module>
- 用git 下载android x86出错(syntax error near unexpected token `newline',`<!DOCTYPE HTML PUBLIC "-//IETF//)