How to check for a string is equivalent to a user input in Python?
<p>I'd like to just read input from the user until a command is executed or a certain string is entered.</p>

<p>For example:</p>

<pre><code>while "!finish" is not line:
    line = input("&gt;")
    file.write(line+"\n")
</code></pre>

<p>I'd like to end the input if the user types in !finish and only that string. How can I go about doing this? Also, if there is a way to use key bindings, then that would be better.</p>
