list of lists?? please help
Alex
cut_me_out at hotmail.com
Tue Sep 26 22:58:31 EDT 2000
> I have two lists, state and node. I want node to be a list of
> states. State is a list itself. The problem is that when I try to add
> state to node, e.g.,
>
> node.append(state)
>
> it only adds a pointer to state. This defeats my goal, because I just
> end up with a list containing the same thing over and over.
It sounds like you want to make a copy of state. Perhaps you can do
something like this:
node.append(state[:])
Alex.
--
Speak softly but carry a big carrot.
More information about the Python-list
mailing list