How can I peek at the next character in a file in Python 3?
<p>Suppose I'm building a parser, and I want to lookahead in the stream.</p>

<p>In Python 2, I could write:</p>

<pre><code>def peek():
    next = inputfile.read(1)
    inputfile.seek(-1,1)
    return next
</code></pre>

<p>however, in Python 3, relative seeks were disabled. </p>