Created
January 23, 2016 15:02
-
-
Save confususs/e6ae1ce256949d8bb99b to your computer and use it in GitHub Desktop.
How to get rid of try
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
dupl = [] | |
for xyz in xyz_array: | |
try: | |
i = [y[0] for y in dupl].index(xyz[:-1]) | |
except: | |
i = False | |
if not i: | |
dupl.append([xyz[:-1], xyz[2:], 1]) | |
else: | |
dupl[i][1]+=xyz[2:] | |
dupl[i][2]+=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment