I thought it was interesting to provide another tip on how create a dict from a list (given the list be the values).
Your solution is perfectly right.
To get the same answer, I'll do:
Code:
>>> d = dict(zip(set(s2ID), map(lambda x: s2ID.count(x), set(s2ID)))) >>> print d {'a02': 3, 'a03': 4, 'a01': 1}
Leave a comment: