Jump to content
  • Advertisement
Sign in to follow this  

Python equivalent of stringstream?

This topic is 5088 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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!