Error when you run hello world Pycharm in "SyntaxError: invalid syntax"

Narrative:

  • When I build a good pycharm + Anaconda, happily go write my first python program "hello, world", enter the print "hello, world", when I click on confidence run, it is wrong - "SyntaxError: invalid syntax" !!!

the reason:

  • Because python2.x and python3.x grammatical difference in print statements;
  • pyhon2.x: print "hello, world" do not need parentheses;
  • python3.x: print ( "hello, world") to be added in brackets;

solve

  • If you do not know the version of python configuration, you can add brackets / remove a try;
Published 14 original articles · won praise 7 · views 443

Guess you like

Origin blog.csdn.net/Sunshine_20201/article/details/104653933