On Sat, Oct 15, 2016 at 11:35 PM, Uday J <udayj2...@gmail.com> wrote:
>>>> bm=dict.fromkeys(l,['-1','-1'])

When you call dict.fromkeys, it uses the same object as the key every
time. If you don't want that, try a dict comprehension instead:

bm = {x: ['-1', '-1'] for x in l}

This will construct a new list for every key, giving you the behaviour
you expect.


Reply via email to