Read and write Ruby-marshalled data.
Only basics Ruby data types can be read and written:
* `str` (mapped to `unicode` in Python 2),
* `nil` (mapped to `None` in Python),
* `array` (mapped to `list`),
* `hash` (mapped to `dict`),
* symbols and other classes are mapped to specific Python classes.
pip install rubymarshal
from rubymarshal.reader import loads, load
from rubymarshal.writer import writes, write
with open('my_file', 'rb') as fd:
content = load(fd)
with open('my_file', 'wb') as fd:
Code is on github: https://github.com/d9pouces/RubyMarshal
Documentation is on readthedocs: http://rubymarshal.readthedocs.org/en/latest/
Tests are on travis-ci: https://travis-ci.org/d9pouces/RubyMarshal
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.