I would like to see how I could remove a certain section of a string without leaving the blank space.
When running this code it outputs nice today
, the problem is that I am replacing the characters with a blank space. Is there a fix to this or should I be using a completely different method entirely?
text = ("hello bye there ")
print(text.replace("hello", "nice").replace("there","today").replace("bye", ""))