Mutable Strings?

Duncan Booth duncan at NOSPAMrcp.co.uk
Tue Jun 26 12:30:34 EDT 2001


Eric Merritt <cyberlync at yahoo.com> wrote in 
news:mailman.993568720.15029.python-list at python.org:

> I have been looking for similar functionality in
> python and have yet to find it. I tried searching the
> archives but any search for terms relating to strings
> returns an enormous amount of hits. In any case, are
> any of you aware of a anything in python that provides
> this type of functionality? I am willing to write my
> own I just don't want to reinvent the wheel.
> 
The usual solution to this is to build a list of strings, which makes 
insert and append nice and easy, and then use the join method of a string, 
or the join function in the string module, to concatenate the list when you 
want a string.
You may also find that in some cases the StringIO or cStringIO modules 
provide what you need. These let you create a file like object that either 
reads from a string, or writes to a string.

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list