Creating a dictionary with same values

Viewed 16120

Suppose I have dictionary a = {} and I want to have it a result like this

value = 12
a = {'a':value,'b':value,'f':value,'h':value,'p':value}

and so on for many keys:same value. Now of course I can do it like this

a.update({'a':value})
a.update({'b':value})

and so on.... but since the value is same for all the keys, don't we have a more pythonic approach to do this?

5 Answers
Related