Skip to content

Instantly share code, notes, and snippets.

@schbrongx
Created April 10, 2017 11:53
Show Gist options
  • Save schbrongx/5f76f7ce5dcf6ecfe2a4fed717827e80 to your computer and use it in GitHub Desktop.
Save schbrongx/5f76f7ce5dcf6ecfe2a4fed717827e80 to your computer and use it in GitHub Desktop.
def print_nested(_obj, _iterator=0):
''' iterate through an iterable object
- print_nested if parameter is another iterable object
- print value if parameter is not iterable
DEPENDENCY: is_iterable.py: https://gist.github.com/schbrongx/ad66fdd50d72b0042cd26c2689b0c10f
'''
for param in _obj:
if is_iterable(_obj[param]):
log.debug(' ' * _iterator + param + ': ')
print_nested(_obj[param], _iterator+1)
else:
log.debug(' ' * _iterator + param + ' = ' + str(_obj[param]))
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment