How to trim n characters from right end of a string?
Paul Bissex
paul.bissex at gmail.com
Sat Jun 26 20:04:27 EDT 2004
On Sat, 26 Jun 2004 23:45:42 GMT, Robert <nospam at nospam.net> wrote:
>
> Please tell this newbie how to remove n characters from the right end of a
> string.
What Tony said, plus this:
>>> s = "chopme"
>>> n = 2
>>> s = s[:-n]
>>> print s
chop
--
paul bissex, e-scribe.com -- database-driven web development
413.585.8095
69.55.225.29
01061-0847
72°39'71"W 42°19'42"N
More information about the Python-list
mailing list