Python parser for TOML
Check out the spec here: https://github.com/mojombo/toml
- Allow multiline arrays.
- Disallow variable rewriting.
- Format to JSON.
- Pypi support (see toml-python)
- Build unittests.
- Improve tests (see toml-test)
- Write de-serializer
- Improve debugging system.
pip install toml-python
>>> import tomlpython
>>> tomlpython.parse("""
[database]
server = "192.168.1.1"
ports = [ 8001, 8001, 8002 ]
""")
{'database': {'ports': [8001, 8001, 8002], 'server': '192.168.1.1'}}
>>> import tomlpython
>>> with open('data.toml') as datafile:
>>> data = tomlpython.parse(datafile)
>>> import tomlpython
>>> tomlpython.toJSON("""
[database]
server = "192.168.1.1"
ports = [ 8001, 8001, 8002 ]
""", indent=4)
{
"database": {
"ports": [ 8001, 8001, 8002 ],
"server": "192.168.1.1"
}
}
- Use
tests/test.py
- See https://github.com/BurntSushi/toml-test
MIT