How to unget a line when reading from a file/stream iterator/generator?
python at bdurham.com
python at bdurham.com
Mon Apr 28 22:10:27 EDT 2008
George,
> Is there an elegant way to unget a line when reading from a file/stream iterator/generator?
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/502304
That's exactly what I was looking for!
For those following this thread, the above recipe creates a generic
object that wraps any iterator with an 'unget' ("push") capability.
Clean and elegant!
Thank you,
Malcolm
More information about the Python-list
mailing list