Skip to content

Instantly share code, notes, and snippets.

@41tair
Created October 30, 2019 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 41tair/b031a6991075adc601239721abdafe1e to your computer and use it in GitHub Desktop.
Save 41tair/b031a6991075adc601239721abdafe1e to your computer and use it in GitHub Desktop.
stupid algorithm
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