How to trim n characters from right end of a string?
Tony Meyer
t-meyer at ihug.co.nz
Sun Jun 27 02:03:06 CEST 2004
> >>> s = "This is a string"
> >>> s[:10]
> 'This is a '
Opps. I guess you really wanted:
>>> s = "This is a string"
>>> s[:-6]
'This is a '
=Tony Meyer
More information about the Python-list
mailing list