On Nov 20, 4:18 am, Peng Yu <pengyu...@gmail.com> wrote: > I'm wondering if there is something similar to list comprehension for > dict
Yes, but only in Python 3: >>> {(i, x) for i, x in enumerate('abc')} {(0, 'a'), (1, 'b'), (2, 'c')} -- http://mail.python.org/mailman/listinfo/python-list