RosettaCodeData/Task/Copy-a-string/Python/copy-a-string-1.py

9 lines
144 B
Python

>>> src = "hello"
>>> a = src
>>> b = src[:]
>>> import copy
>>> c = copy.copy(src)
>>> d = copy.deepcopy(src)
>>> src is a is b is c is d
True