Skip to content

Instantly share code, notes, and snippets.

@cben
Created September 13, 2014 20:14
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 cben/af2ee02bd7193a2429e4 to your computer and use it in GitHub Desktop.
Save cben/af2ee02bd7193a2429e4 to your computer and use it in GitHub Desktop.
>>> 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
@hadisinaee
Copy link

hmm ... that's cool! 👍 Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment