0

My code is simple. The problem is input command. I try to write python code that accept user string input from the keyboard and display it. But it Generate this error message always SyntaxError: unexpected EOF while parsing

Generally my python code always can't accept user string input from the keyboard. any one can tell me the problem or fix this error message?

this is code

Message = input('> ')
Word = Message.split(' ')
print (Word)

Error Message

Traceback (most recent call last):
  File "C:/Users/My_Computer_Name/PycharmProjects/test/tests.py", line 1, in <module>
    message = input('> ')
  File "<string>", line 1
    Hi hi
        ^
SyntaxError: unexpected EOF while parsing
Charles Duffy
  • 280,126
  • 43
  • 390
  • 441

1 Answers1

0

Seems like you're using python 2.x so you would need to do:

Message = raw_input('> ')
Word = Message.split(' ')
print (Word)

I would definitely suggest upgrading to python 3.7 (3.8 is not supported for all packages).

Gorlomi
  • 515
  • 2
  • 11
  • Note the bullet point regarding questions that "have already been asked and answered many times before" in the *Answer Well-Asked Questions* section of [How to Answer](https://stackoverflow.com/help/how-to-answer). – Charles Duffy Mar 01 '20 at 21:51
  • ah well.. good stuff then! – Gorlomi Mar 01 '20 at 21:51