[Tutor] String question
Alan Gauld
alan.gauld at blueyonder.co.uk
Fri Jul 2 13:15:44 EDT 2004
> Traceback (most recent call last):
> File "C:\Python23\filter.py", line 49, in ?
> input ()
> File "<string>", line 0
> ^
> SyntaxError: unexpected EOF while parsing.
The problem is your use of input()
It reads the blank line you type and tries to evaluate it,
which it can't do.
Use raw_input instead, it simply assigns the string
(to nothing in this case) without attempting to evaluate it.
Try using the interactive prompt to see the same thing:
>>> input()
<--
Traceback (most recent call last):
File "<input>", line 1, in ?
File "<string>", line 0
^
SyntaxError: unexpected EOF while parsing
>>> raw_input()
<--
'\n'
>>>
HTH
Alan G.
More information about the Tutor
mailing list