4 ms·
What are you talking about? http://docs.python.org/2/library/string.html http://docs.python.org/2/library/string.html
by ShawnBird 13y ago
What are you talking about?
http://docs.python.org/2/library/string.html http://docs.python.org/2/library/string.html
- pyre 13y ago>>> a = "string" >>> a[1] = 'g' Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'str' object does not support item assignment >>> b = a.replace('t', 'g') >>> b 'sgring' >>> a 'string' >>> id(b) 3065252256L >>> id(a) 3075481632L Also from here[1]: Strings and tuples are immutable sequence types: such objects cannot be modified once created. [1] http://docs.python.org/2/library/stdtypes.html#mutable-sequence-types http://docs.python.org/2/library/stdtypes.html#mutable-seque...
- deleted 13y ago[deleted]