fork(1) download
  1. # your code goes here
  2. # your code goes here
  3. data={
  4. "a":{
  5. "b":{
  6. "c":1
  7. },
  8. "f":5
  9. },
  10. "d":"2",
  11. "e":"3",
  12. "g":{
  13. "h":{
  14. "j":"10"
  15. }
  16. }
  17. }
  18.  
  19.  
  20. def print_nested(d, prefix=''):
  21. for k, v in d.items():
  22. if isinstance(v, dict):
  23. print_nested(v, '{}{}__'.format(prefix, k))
  24. else:
  25. print '{}{} = {}'.format(prefix, k, v)
  26.  
  27. print_nested(data);
  28.  
Success #stdin #stdout 0.01s 9016KB
stdin
Standard input is empty
stdout
a__b__c = 1
a__f = 5
e = 3
d = 2
g__h__j = 10