Created
October 30, 2019 20:22
-
-
Save 41tair/b031a6991075adc601239721abdafe1e to your computer and use it in GitHub Desktop.
stupid algorithm
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
t1 = ["123",["ddd", "ccc","344", ["lll"], ['zzz']],"333"] | |
def a(l): | |
c = [] | |
z = [] | |
if any([isinstance(x, list) for x in l]): | |
for i in l: | |
if len(i) == 1: | |
z.append(i) | |
if not isinstance(i, list): | |
c.append(i) | |
else: | |
a(i) | |
if z: | |
print z | |
if c: | |
print c | |
a(t1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment