Created
August 12, 2020 16:16
-
-
Save Cyril-Pop/09a7d2d09be7cf36723aaed007ff86d5 to your computer and use it in GitHub Desktop.
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
var2 = ['a','b','b','c','d','e', 'g', 'a', 'b','c', 'a','b','c','e'] | |
def splitChar2(lst): | |
temp = [] | |
for idx, x in enumerate(lst): | |
try: | |
if lst[idx + 1] != 'a': | |
temp.append(x) | |
else: | |
temp.append(x) | |
yield temp | |
temp = [] | |
splitChar2(lst[idx + 1:]) | |
except IndexError: | |
temp.append(x) | |
yield temp | |
varw =[ x for x in splitChar2(var2)] | |
print (varw) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment