Invalid syntax with print "Hello World"

Discussion in 'Python' started by Henrik Bechmann, Mar 12, 2009.

  1. obviously total mewbiew:

    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
    Henrik Bechmann, Mar 12, 2009
    #1
    1. Advertising

  2. Henrik Bechmann

    Gary Herron Guest

    Henrik Bechmann wrote:
    > obviously total mewbiew:
    >
    > 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?
    >


    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
    >
    Gary Herron, Mar 12, 2009
    #2
    1. Advertising

  3. Daniel Fetchinson, Mar 12, 2009
    #3
  4. Henrik Bechmann

    John Machin Guest

    On Mar 12, 5:57 pm, Henrik Bechmann <> wrote:
    > obviously total mewbiew:
    >
    > My first program in Python Windows


    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
    >
    > 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
    John Machin, Mar 12, 2009
    #4
  5. On Mar 12, 2:25 am, John Machin <> wrote:
    > On Mar 12, 5:57 pm, Henrik Bechmann <> wrote:
    >
    > > obviously total mewbiew:

    >
    > > My first program in Python Windows

    >
    > 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
    >
    >
    >
    >
    >
    > > 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- Hide quoted text -

    >
    > - Show quoted text -


    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
    steven.oldner, Mar 12, 2009
    #5
  6. Henrik Bechmann

    Paul Boddie Guest

    On 12 Mar, 12:45, Dotan Cohen <> wrote:
    >


    [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
    Paul Boddie, Mar 12, 2009
    #6
  7. On Thursday 12 March 2009 07:45:55 am Dotan Cohen wrote:
    > 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.


    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
    Luis Zarrabeitia, Mar 12, 2009
    #7
  8. Henrik Bechmann

    timmylangeveld

    Joined:
    Apr 9, 2010
    Messages:
    1
    2.6 vs 3.0

    Hello, I'm a total newbie aswel.

    I am wondering why python 2.6 or even 2.5.4 is still educated and not 3.0?
    I have read that 3.0 is complete redesign of the language, so I asume it would be helpful to educate in that version.

    Is there anyone who can explain this?

    Best regards,
    timmylangeveld, Apr 9, 2010
    #8
  9. Henrik Bechmann

    Guest

    On Thursday, March 12, 2009 3:25:53 PM UTC+8, John Machin wrote:
    > On Mar 12, 5:57 pm, Henrik Bechmann <> wrote:
    > > obviously total mewbiew:
    > >
    > > My first program in Python Windows

    >
    > 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
    > >
    > > 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


    Thank you.I got the same error.And your suggestion is so useful.
    , Apr 13, 2013
    #9
  10. Henrik Bechmann

    Guest

    Am Donnerstag, 12. März 2009 07:57:11 UTC+1 schrieb Henrik Bechmann:
    > obviously total mewbiew:
    >
    > 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


    thanx
    , Nov 14, 2013
    #10
  11. Henrik Bechmann

    bob gailer Guest

    On 11/14/2013 10:05 AM, wrote:
    > Am Donnerstag, 12. März 2009 07:57:11 UTC+1 schrieb Henrik Bechmann:
    >> obviously total mewbiew:
    >>
    >> My first program in Python Windows
    >>
    >> print "Hello World"

    I assume you are running Python 3 in which case you need
    > print("Hello World")


    --
    Bob Gailer
    919-636-4239
    Chapel Hill NC
    bob gailer, Nov 14, 2013
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vijay
    Replies:
    8
    Views:
    705
  2. Roy
    Replies:
    6
    Views:
    610
    Roedy Green
    Jan 7, 2008
  3. ianb
    Replies:
    0
    Views:
    434
  4. Dr DOOM
    Replies:
    2
    Views:
    150
    Dr DOOM
    Aug 10, 2003
  5. Larry
    Replies:
    27
    Views:
    424
    Michele Dondi
    Jan 25, 2005
Loading...

Share This Page