Currently, I do something like
count = 0
for item in list:
if count == len(list) - 1:
<do something>
else:
<do something else>
count += 1
Is there a more Pythonic way to recognize the final iteration of a loop - for both lists and dictionaries?