fperez528 at yahoo.com
Mon Nov 26 01:02:19 CET 2001
> Sang DeSibtis wrote:
>> Questions: how do I make a global replacements in the 'line' that
>> read from the file object (buffer in memory? ).
The key thing to understand is that in Python, strings are immutable, so you
can never do *anything* in place to a string. All string operations return a
new string, which if you want to work 'in place' you can just reassign to
your original string:
string = do_whatever(string)
Even string methods don't work in-place:
In : s='abc'
In : s.replace('a','A')
In : s
More information about the Python-list