Need to unread or push back bytes to a file
Noah Spurrier (a)
noahnoah.org
Fri Feb 23 20:09:48 EST 2001
More information about the Python-list mailing list
Fri Feb 23 20:09:48 EST 2001
- Previous message (by thread): Need to unread or push back bytes to a file
- Next message (by thread): Need to unread or push back bytes to a file
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I need to push bytes back into a file object. Is there a buffered file wrapper for file objects? (Yes, I looked, but I gave up after almost five minutes of searching.) I'm reading from a pipe, but this could be the same for a file. I call an "expect" method which reads until a pattern is found, but read() with a pipe will read as much data as there is available in the pipe. When I have found a pattern match I want to return the stream with the extra character pushed-back. Another way to word this is that I want to the of a pattern, but not past the pattern. My only other option would be to read(1) character at a time and then search for the pattern. This will work, but I think a push-back would be more elegant and efficient. Yours, Noah ================================== Posted via http://nodevice.com Linux Programmer's Site
- Previous message (by thread): Need to unread or push back bytes to a file
- Next message (by thread): Need to unread or push back bytes to a file
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list