modifying string objects

Mark McEahern marklists at mceahern.com
Thu Jun 13 12:00:24 EDT 2002


Short answer:  Stick the string in something that is mutable:

s = "foobar"

def change_it(x):
    x[0] = x[0] + "foo"

x = [s]
change_it(x)
s = x[0]

print s

// m
-






More information about the Python-list mailing list