Created
October 15, 2016 14:12
-
-
Save irondoge/b87efd95d55d4e65308101e219038885 to your computer and use it in GitHub Desktop.
Get python list dimensions number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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