On 15.10.2016 18:16, Steve D'Aprano wrote:
# Python 3 only: use a dict comprehension
py> d = {x:[] for x in (1, 2, 3)}
py> d
{1: [], 2: [], 3: []}

dict (and set) comprehensions got backported so this works just as well in Python 2.7

Wolfgang

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to