I'm a python new-comer, so there is probably a simple answer to this question, but I have looked and found nothing.
I want to define a function that when this is entered: "function(abcdefg123, fg1, " ")" the return is this: "abcde 23". I think it would look like this:
def function(something, what_to_deleat, what_to_substitute):
if str(what_to_deleat) in str(something):
return ## Code that replaces "what_to_deleat" with "what_to_substitute" within "something"
else:
return something
A practical application (and the one I'm wanting to use this for) would convert 25.0 into 25 if 'function("25.0", ".0", "")' was entered.