How can you copy (clone) a string?

Fredrik Lundh effbot at telia.com
Tue Oct 3 10:23:36 EDT 2000


Max Møller Rasmussen wrote:
> Just use slice:
>
> a = 'a'
> b = a[:]

>>> a = 'a'
>>> b = a[:]
>>> id(a)
7834944
>>> id(b)
7834944
>>> a is b
1

</F>




More information about the Python-list mailing list