a simple question about string object
Alex Martelli
aleax at aleax.it
Mon Mar 17 02:54:12 EST 2003
Tim Roberts wrote:
...
>>>>> s = '12345'
>>>>> s[2] = 'x'
...
>>should i define a function to do this? Is there any modules existing can
>>do this?
>
> There is no standard module to do this. If you need to do this a lot, you
Actually, module UserString, class MutableString, might help.
>>> import UserString
>>> st = UserString.MutableString
>>> s = st('12345')
>>> s[2] = 'x'
>>> s
'12x45'
>>>
Alex
More information about the Python-list
mailing list