copying a string???
joec at mill.co.uk
Thu Aug 22 06:14:20 EDT 2002
I have a function that alters the value of a string (written in C). (is
in the following code
str1 = "hi there"
str2 = copy.deepcopy(str1)
changeString() changes both str2 and str1, where I only want it to
change str2 - hence the deepcopy().
I have also tried these
str2 = copy.copy(str1)
str2 = str1
does deepcopy just assume that becuase a string doesn't support
assignment it can reference rather than copy it?
anyone know how I can really copy the string? or am I missing something
More information about the Python-list