How to remove all characters before a specific character in Python?
str.find
could find character index of certain string's first appearance
:
intro[intro.find('I'):]
Use re.sub
. Just match all the chars upto I
then replace the matched chars with I
.
re.sub(r'^.*?I', 'I', stri)