ungetch in Python

Scott Fenton scott at fenton.baltimore.md.us
Wed Dec 24 18:41:13 CET 2003


Hello and merry chrismas/new years/<insert winter holiday> everyone,

I'm writing a small parser for a minilanguage in Python,
and I was wondering --- is there any equiv. of C's ungetch
or Scheme's peek-char in python? That is, is there a way to
look at a character without taking it off of the input stream
or is there a way to put it back on the input stream afterwards?
I googled around and didn't come up with anything that didn't
involve curses, which I don't want to use. Any help?

TIA
-Scott




More information about the Python-list mailing list