modifying string objects
Mark McEahern
marklists at mceahern.com
Thu Jun 13 12:00:24 EDT 2002
More information about the Python-list mailing list
Thu Jun 13 12:00:24 EDT 2002
- Previous message (by thread): modifying string objects
- Next message (by thread): modifying string objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
-
- Previous message (by thread): modifying string objects
- Next message (by thread): modifying string objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list