Dictionary and List

Oleg Broytmann phd at phd.russ.ru
Fri Oct 22 07:40:33 EDT 1999


On Fri, 22 Oct 1999 sorot at my-deja.com wrote:
> for i in range(0,len(x)):
>    my_dict['a'] = x[i]
>    my_list.append(my_dict)
     ^^^^^^^^^^^^^^^^^^^^^^^

   You are appending my_dict again and again, without resetting its
content.

Oleg.
---- 
    Oleg Broytmann      Foundation for Effective Policies      phd at phd.russ.ru
           Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list