Created
September 13, 2014 20:14
-
-
Save cben/af2ee02bd7193a2429e4 to your computer and use it in GitHub Desktop.
YAML using example from https://github.com/kinghadi/Python-PrettyPrintDictionary
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
>>> import yaml # need to install PyYAML | |
>>> dict_1 = {'a': 0, '1': {1: {'abc': [1, 2, 3, 4, 5, 6], 'efg': [7, 8, 9, 10, 100]}, | |
2: {'1': {1: 'abc', 2: 'efg'}, '2': {3: 'abc'}}}, '2': [1, 2, 3, 4, 5, 6]} | |
>>> print(yaml.safe_dump(dict_1, default_flow_style=False)) | |
'1': | |
1: | |
abc: | |
- 1 | |
- 2 | |
- 3 | |
- 4 | |
- 5 | |
- 6 | |
efg: | |
- 7 | |
- 8 | |
- 9 | |
- 10 | |
- 100 | |
2: | |
'1': | |
1: abc | |
2: efg | |
'2': | |
3: abc | |
'2': | |
- 1 | |
- 2 | |
- 3 | |
- 4 | |
- 5 | |
- 6 | |
a: 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hmm ... that's cool! 👍 Thanks :)