Returning dictionary from a function

Jeff McNeil jeff at
Fri May 15 00:00:16 CEST 2009

On May 14, 5:44 pm, kk <maymunbe... at> wrote:
> Btw my main problem is that when I assign the function to 'b' variable
> I only get the last key from the dictionary. Sorry about that I forgot
> to mention the main issue.

You're creating a new dictionary with each iteration of your loop, use
d[k] = v syntax instead.

More information about the Python-list mailing list