Advertisement
Guest User

Untitled

a guest
Dec 14th, 2015
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. def same_structure_as(original, other):
  2.     print(original, other)
  3.     if type(original) == type(other):
  4.         try:
  5.             for i in range(len(original)):
  6.                 if isinstance(original[i], list) and isinstance(other[i], list):
  7.                     return same_structure_as(original[i], other[i])
  8.                 elif not isinstance(original[i], list) and not isinstance(other[i], list):
  9.                     pass
  10.                 else:
  11.                     return False
  12.         except IndexError:
  13.             return False
  14.     else:
  15.         return False
  16.     return True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement