how to compare keyboard input to a string in Python?
<p>I m trying to compare keyboard input to a string:</p>

<pre><code>import sys

# read from keyboard
line = sys.stdin.readline()
if line == "stop":
    print 'stop detected'
else:
    print 'no stop detected'
</code></pre>

<p>When I type 'stop' at the keyboard and enter, I want the program to print 'stop detected' but it always prints 'no stop detected'. How can I fix this?</p>
