Home  >  Article  >  Backend Development  >  为什么在python下编写print ‘hello world’ 提示invalid syntax?

为什么在python下编写print ‘hello world’ 提示invalid syntax?

WBOY
WBOYOriginal
2016-06-06 16:24:101720browse

使用的是python3.3,在百度查过是因为版本的问题。可是我没有配套学习的文档啊。谁能给我提供一份呢?python下如何编写hello world呢?

回复内容:

Python 3 以后print已经是函数而非关键字。请使用正确语法:
print("Hello world")
这或许就是Python的错误决策之一

任何优秀的编程系统对已有代码的兼容性应该是至高无上的。Linus一直是这么要求Linux的ABI/API的,所以Linux Kernel才能这么多年一直是开源项目的标杆 我只想问一句:为什么不查一下Document呢?

RTFM!!! 兼容性太傻逼了。。 我也是新手,
看得是基于2.5版本的基于win写的教材,,,,然后ubuntu上预装的是2.7.。。win上面我下载的是3.3.。。。于是现在Win上面学起。
刚刚按教材写第一个print程序,,,,就提示我invalid syntax....不看这个贴,,,我一定会郁闷下去。。。T_T,我要卸载3.3.。。 windows服务器上装的2.7.3,个人笔记本上用2.7.5,linux上渣渣竟然自带的还是2.4版本,迁移时头疼死了,这个方法不支持了,那个方法要替换了,,啊啊啊啊 为什么不用2.X的呢?现在很多高版本的python兼容以前的版本不是很好,很多开源项目还是使用2.6或者2.7的呢,就简单的print 语法都不一样
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn