Skip to content

Instantly share code, notes, and snippets.

@Cyril-Pop
Last active August 14, 2020 15:20
Show Gist options
  • Save Cyril-Pop/4e3d8401d070e3dae12a4c1b45be1ea5 to your computer and use it in GitHub Desktop.
Save Cyril-Pop/4e3d8401d070e3dae12a4c1b45be1ea5 to your computer and use it in GitHub Desktop.
fix double item Solo
var5 = [["A","B","C"],["D"],["E","F","H"],["I"],["A","B","C"],["D","G"],["E","F","H"],["I"],["E","F","H"],["I"],["A","B","C"],["D"],["E","F"],["I"],["D"],["E","F","H"],["I"],["A","B","C"],["E","F","H"],["I"]]
iterable = iter(var5)
flag = True
out = []
while flag:
try:
sublst = next(iterable)
if len(sublst) > 1:
out.append(sublst)
else:
out[-1].extend(sublst)
except StopIteration:
flag = False
break
OUT = out
print (OUT)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment