Remove the first few(or any amount really) of letters in a string
Terry Reedy
tjreedy at udel.edu
Fri Aug 8 22:58:10 EDT 2008
Alexnb wrote:
> Lets say I've got a stirng:
>
> blah This is my string blah
>
> I want to get rid of the blah's but keep the "This is my string." I know you
> can do this with a for loop, but that is messy and a pain. So does anyone
> have any suggestions on how to do this?
Strings are immutable. Just slice out what you want.
IDLE 3.0b2
>>> "blah This is what I want. blah blah"[5:25]
'This is what I want.'
More information about the Python-list
mailing list