I noticed the following strange behaviour when I try to use replace
in a function. Let's say we have the following function:
def string_replace(string, arg):
string.replace(arg, "")
return string
This function is supposed to get rid of the arg
in the string
argument, but it doesn't seem to work. For example:
string_replace('There.', '.')
< There.
But if I type:
"There.".replace(".", "")
everything goes smoothly.
Any logical explanation?