R
Robert
Please tell this newbie how to remove n characters from the right end of a
string.
Thanks, Robert
string.
Thanks, Robert
Please tell this newbie how to remove n characters from the right end of a
string.
chops = "chopme"
n = 2
s = s[:-n]
print s
At the Python '>>>' prompt:Robert said:Please tell this newbie how to remove n characters from the right end of a
string.
Thanks, Robert
This is a sta = "This is a string."
print a[:-5]
Paul McGuire said:At the Python '>>>' prompt:Robert said:Please tell this newbie how to remove n characters from the right end of a
string.
Thanks, Robert
This is a sta = "This is a string."
print a[:-5]
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.