Friday, May 20, 2011

python awesomesness 1

I am sure many folks go through this phase when writing python code after other languages.

return dict( zip(x, range(len(x))))

is a line of code I needed.

Converted a sorted list to a dictionary of list items and the index of the item.

No comments:

Post a Comment