Skip to content

Instantly share code, notes, and snippets.

@kaidokert
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaidokert/37899b0aac0bd6639c44 to your computer and use it in GitHub Desktop.
Save kaidokert/37899b0aac0bd6639c44 to your computer and use it in GitHub Desktop.
Everyones favorite config formats
# 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