Skip to content

Instantly share code, notes, and snippets.

@irondoge
Created October 15, 2016 14:12
Show Gist options
  • Save irondoge/b87efd95d55d4e65308101e219038885 to your computer and use it in GitHub Desktop.
Save irondoge/b87efd95d55d4e65308101e219038885 to your computer and use it in GitHub Desktop.
Get python list dimensions number
def dims(lst):
ct = 1
while list in [ type(i) for i in lst ]:
lst = sum([ i for i in lst if type(i) == list ], [])
ct += 1
return ct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment