Python equivalent of stringstream?
I have recently been working on some scripts to parse various binary file formats, which can generally be viewed as a tree of "chunk" structures. For parsing it is convenient to be able to extract "sub-chunks" recursively, reading the chunk as if it were its own file. So, is there a good Python idiom for making a string behave like a file (rather, constructing some sort of file-like object using a string's data)? I currently am using my own (very ugly hack of a) wrapper implementing the file methods that I need, but I'm convinced I should be able to do better. But I couldn't find anything in the documentation (at least, nothing I can figure out how to put to good use)... any leads would be greatly appreciated [smile]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement