Last active
August 14, 2020 15:20
-
-
Save Cyril-Pop/4e3d8401d070e3dae12a4c1b45be1ea5 to your computer and use it in GitHub Desktop.
fix double item Solo
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
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