My first program in Python Windows
print "Hello World"
I select Run/Run Module and get an error:
Syntax error, with the closing quote highlighted.
Tried with single quotes as well. Same problem.
Can someone explain my mistake?
Thanks,
- Henrik
You are apparently using Python2 syntax in Python3. Python3 has made
some incompatible changes from previous version of Python2.
In Python2: print "Hello World"
In Python3: print("Hello World")
Either download Python2.5 (or 2.6) to go with your tutorial, or find a
Python3 tutorial to go with your Python3 installation. Once you are
familiar with either version of the language, you will find that the
differences are not very large, but using out-of-sync tutorials and
implementations will be the source of much frustration.
Welcome to Python.
Enjoy.
Gary Herron
> Thanks,
>
> - Henrik
> --
> http://mail.python.org/mailman/listinfo/python-list
>
Are you using python 3.0? In this case please see:
http://docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function
HTH,
Daniel
--
Psss, psss, put it down! - http://www.cafepress.com/putitdown
What is that you are callind "Python Windows"? What version of Python
are you running?
2.X: print "Hello World"
should work.
3.X: print is now a function,
print("Hello World")
should work.
If that gets you going: read the tutorial that belongs to the version
of Python that you are using.
If it doesn't, come back here with a bit more detail.
BTW, don't indent your first line. Make sure it starts in column 1.
HTH,
John
Henrik,
Welcome to the list. As a newbie myself, I ran into the Python3 vrs
2.6 issue. May I suggest starting with 2.6? There is many more books
and internet stuff you can learn with in 2.6 - and the examples will
work. As Garry wrote, once you understand 2.6, 3.0 will not be a
challenge.
Steve Oldner
I do not think that is the best way to go about learning Python. Why
learn an arguably depreciating version when the new version is
available. I agree that there are not many tutorial written for Python
3 however there are enough to get going: most of the Python 2
tutorials are redundant. Sticking to Python 3 tutorials will give him
a higher signal-to-noise ratio in the tutorials that he finds.
--
Dotan Cohen
http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه-و-ي
А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я
а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я
ä-ö-ü-ß-Ä-Ö-Ü
[starting with 2.6]
> I do not think that is the best way to go about learning Python. Why
> learn an arguably depreciating version when the new version is
> available. I agree that there are not many tutorial written for Python
> 3 however there are enough to get going: most of the Python 2
> tutorials are redundant. Sticking to Python 3 tutorials will give him
> a higher signal-to-noise ratio in the tutorials that he finds.
So we are to conclude that Python 2 is redundant now, are we?
I don't think it's bad advice to suggest that people learn Python 2 if
they want to get stuff done, and since people keep saying how Python 3
is really the same language, let us entertain that assertion and
encourage people to take advantage of its predecessor: the thing which
actually powers the overwhelming majority of Python-powered systems
today and for the foreseeable future.
Paul
Thanks everyone!
Now that I know what the issue is (2 vs 3), I'll be able to resolve
those kinds of issues in the future.
Thanks again!
- Henrik
Because it is not only the language that matters, you also need the libraries
to accomplish real-world tasks. As a language, python2 is an impressive one,
and python3 is a great improvement over python2, but python3 still lacks some
of the libraries and framewoks that makes programming in python so extremely
delightful (yes, I like python :D).
I don't consider python2 deprecated (can't be deprecated yet!), and as a
teacher and/or student, I'd recomment to teach/learn python2.5-2.6, keeping
an eye on all those features that are new in python3... and backporting
everything that is possible to backport.
> I agree that there are not many tutorial written for Python
> 3 however there are enough to get going: most of the Python 2
> tutorials are redundant. Sticking to Python 3 tutorials will give him
> a higher signal-to-noise ratio in the tutorials that he finds.
That is true. We need python tutorials aimed at python2.6 :D
--
Luis Zarrabeitia (aka Kyrie)
Fac. de Matemática y Computación, UH.
http://profesores.matcom.uh.cu/~kyrie