[Tutor] Comparing two lines of print
Bob Heasman
bobhe at telkomsa.net
Wed Jun 2 09:00:05 EDT 2004
Alan Gauld wrote:
>>When I attempt to run this script I get a syntax error:-
>>
>>[root at penguin bob]# ./readfile.py
>> File "./readfile.py", line 14
>> if text_file.readline() == [PORT 6 (PTCPACTOR) - 19 - UA6ADV-0]
>> ^
>>SyntaxError: invalid syntax
>
>
> You are comparing a string (from raw_input()) with a list.
> I assume you need quotes around the [PORT....-0] stuff?
>
> Alan G
>
>
>
Hello Alan,
Yes I now see what is happening. When I had the quotes in it appeared
to be ignoring two lines of code. Now I see that it IS comparing them
and, due to the quotes, it says they are not the same. Sorry, I am so
new to this game I cannot see the wood for the trees.
Phew, back to the drawing board.
Regards.
Bob
More information about the Tutor
mailing list