How to trim n characters from right end of a string?
nospam at nospam.net
Sun Jun 27 02:34:13 CEST 2004
"Paul McGuire" <ptmcg at austin.rr._bogus_.com> wrote in message
news:ydoDc.13674$OX2.13266 at fe2.texas.rr.com...
> "Robert" <nospam at nospam.net> wrote in message
> news:GUnDc.13670$OX2.9785 at fe2.texas.rr.com...
> > Please tell this newbie how to remove n characters from the right end of
> > string.
> > Thanks, Robert
> At the Python '>>>' prompt:
> >>> a = "This is a string."
> >>> print a[:-5]
> This is a st
Got it! Thanks Tony and Paul!
More information about the Python-list