基本 Python Hello World 程序语法错误 [英] Basic Python Hello World Program Syntax Error
问题描述
我在编程方面并不是那么新,但在 Python 方面我确实是个新手,所以当我开始从教程中学习 Python 时,他们鼓励我使用 Python 的 IDLE 编辑器.所以作为一个新手,我遇到了这个奇怪的 Hello World 问题.
I am not that really new in Programming but in Python I am really a newbie, and so when I started learning Python from the tutorials they encouraged me to use the IDLE editor for Python. And so as a newbie I had this weird Hello World problem.
如你所见,我在 Linux(CentOS 6.2) 中使用 Python 2.6.6
as you can see i use Python 2.6.6 in Linux(CentOS 6.2)
我尝试了几乎所有可能的语法,打印 python 2.6 和新 python 3 文档中提供的简单 HELLOWORLD
and I tried almost all the possible syntaxes printing the simple HELLOWORLD provided in the documentation of python 2.6 and the new python 3
我试过打印这样的内容
print 1 + 1
它与输出一起工作
>>> 2
我想知道如何打印这个简单的HELLOWORLD
I want to know how can i print this simple HELLOWORLD
推荐答案
检查以确保您确实使用了直引号.一些程序/系统会自动将它们替换为大引号.
Check to make sure that you are really using straight quotes. Some programs/systems automatically replace them with curly quotes.
在这里尝试复制粘贴并运行它:
Here try copy pasting this and running it:
print "hello"
如果这变成了一个问题,那么您可能想在 https://unix.stackexchange.com/ 上询问如何禁用此类功能.
If this turn's out to be an issue then you might want to ask at https://unix.stackexchange.com/ how to disable such a feature.
这篇关于基本 Python Hello World 程序语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!