string methods

tiissa tiissa at nonfree.fr
Sat Jul 30 11:26:54 EDT 2005


anthonyberet wrote:
> I know this touches on immutability etc, but I can't find string methods 
> to return the first 3 characters, and then the last 2 characters, which 
> I could concatenate with newchar to make a new string.
> 
> I know the string methods are there, but can't find it in any docs, and 
> just want to check the syntax, unless there is an easier way.

Strings [1] are sequences [2], and therefore support slicing, which is 
what you are looking for.


[1] http://docs.python.org/lib/string-methods.html
[2] http://docs.python.org/lib/typesseq.html



More information about the Python-list mailing list