Anyone can help with this? Imagine the following:
def example(s):
s = s.replace('foo', 'foo bar')
return s
Now this will replace ‘foo’ with ‘foo bar’; But I want to do something a bit different:
* Imagine I have ‘foo something’; I want the final result to be: ‘foo something bar’
What would be the best way to make such check (if there is a ‘something’, I want to preserve it).
Anyone can help please ?
NM
Use the
remodule.