Last active
August 29, 2015 14:25
-
-
Save kaidokert/37899b0aac0bd6639c44 to your computer and use it in GitHub Desktop.
Everyones favorite config formats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install pytoml pyaml | |
import pytoml | |
import yaml | |
import json | |
# no ConfigParser here | |
testdict={'copterz': 'lol', | |
'nest': {'this': 'that'}, | |
'nestnest': {'hive': { 'bees' : 3, 'ants' : -1} , 'house' : 'frogs' }, | |
'mah' : ['dogs','catz'], | |
'bits' : 9, | |
'parity' : 4.5 | |
} | |
print('\n'.join(('---json---',json.dumps(testdict,indent=2)))) | |
print('\n'.join(('---toml---',pytoml.dumps(testdict)))) | |
print('\n'.join(('---yaml---',yaml.dump(testdict)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment