Skip to content

Instantly share code, notes, and snippets.

@confususs
Created January 23, 2016 15:02
Show Gist options
  • Save confususs/e6ae1ce256949d8bb99b to your computer and use it in GitHub Desktop.
Save confususs/e6ae1ce256949d8bb99b to your computer and use it in GitHub Desktop.
How to get rid of try
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