Sign in to follow this  

Python equivalent of stringstream?

This topic is 4745 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites

This topic is 4745 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this