Thanks, thats a really handy function
"Ron_Adam" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sun, 27 Mar 2005 09:01:20 GMT, "Nick L" <[EMAIL PROTECTED]> > wrote: > > >I've hit a brick wall on something that I'm guessing is pretty simple but > >it's driving me nuts. > > Yes, I've ran across that too a few times. > > > How on earth can I make a complete seperate copy of a list with out it > >being a attached to the original in any way shape or form so that I can > >modifiy if at will and not worry about the original? > > This routine copies a list of lists. > > > # Makes a copy of a list of lists > # Containing simple data. > def copylistlist(alist): > if type(alist) is list: > copy = [] > for i in alist: > if type(i) is list: > i = copylistlist(i) > copy.append(i) > return copy > > bob = [[[0, 0]]] > final = copylistlist(bob) > > print 'bob:'bob > print 'Final:'final > > > This still doesn't create new items within the new list. but with > literal data consisting of letters and numbers, it will work. > > If you are working with a data tree, you may be able to modify this to > do what you want. Just add a test in the inner loop for the data you > want to modify. > > > >Any ideas, suggestions, comments are greatly appreciated > >thanks > > > >Nick > > Hope that helps. > > Ron_Adam > > -- http://mail.python.org/mailman/listinfo/python-list