I'd like to remove all characters before a designated character or set of characters (for example):
intro = "<>I'm Tom."
Now I'd like to remove the <> before I'm (or more specifically, I). Any suggestions?
<>
I'm
I
Use re.sub. Just match all the chars upto I then replace the matched chars with I.
re.sub
re.sub(r'^.*?I', 'I', stri)
2.1m questions
2.1m answers
60 comments
56.9k users