Zer0Div

Untitled

Dec 2nd, 2020
450
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def flatten(d, parent_key='', sep='/'):
  2.     items = []
  3.     for k, v in d.items():
  4.         new_key = parent_key + sep + str(k) if parent_key else str(k)
  5.         print(new_key)
  6.         if type(v)== dict and bool(dict)==True:
  7.             items.extend(flatten(v, new_key, sep=sep).items())
  8.         elif (type(v)==dict) and (bool(v)==False):
  9.             print('Here we go')
  10.             items.append((new_key, ""))
  11.         else:
  12.             items.append((new_key, v))
  13.        
  14.         print(items)
  15.     return dict(items)
RAW Paste Data