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