I m trying to compare keyboard input to a string:
import sys # read from keyboard line = sys.stdin.readline() if line == \"stop\": print \'stop detected\' e
sys.stdin.readline() includes the trailing newline character. Either use raw_input(), or compare line.rstrip("\n") to the string you are looking for (or even line.strip().lower()).
sys.stdin.readline()
raw_input()
line.rstrip("\n")
line.strip().lower()