string - How to remove all characters before a specific character in Python? -
i'd remove characters before designated character or set of characters (for example):
intro = "<>i'm tom."
now i'd remove <>
before i'm
(or more specifically, i
). suggestions?
use re.sub
. match chars upto i
replace matched chars i
.
re.sub(r'.*i', 'i', stri)
Comments
Post a Comment