Newbie-list-problem: how to supress constraining 2 lists - a=b ?

HugOnline thehugonline at yahoo.de
Fri Nov 8 05:35:33 EST 2002


Hello,

I'm a Python - newbie and I can not solve the following problem:

>>>a=[8,7,6,5,4]   # set this list to a
>>>b=a             # I' want to have two same lists: a and b
>>>b.sort()        # b should be sorted
>>>print b         # it's ok 
[4,5,6,7,8]
>>>print a
[4,5,6,7,8]        # but a is sorted, too !!!  

How can I suppress the constraining of a and b? I want to have in the
result two list - a unsorted and b sorted. Is there a switch to supress
it?

Regards  HugOnline



More information about the Python-list mailing list