I have lines with words separated by dots. Example:
string1 = 'one.two.three.four.five.six.eight' string2 = 'one.two.hello.four.five.six.seven'
How to use this line in python method, assigning one word as a template (because in this case, for example, the third word changes). I am thinking about regular expressions, but I donβt know if such an approach is possible, as I have in mind, in python. For instance:
string1.lstrip("one.two.[wildcard].four.")
or
string2.lstrip("one.two.'/.*/'.four.")
(I know that I can extract this with split('.')[-3:] , but I'm looking for a general way, lstrip is just an example)
source share