I created a function which replace word by special characters in string. It works well once I need to replace only one word. Now I need to have possibility to extend list of words from one to more (2, 3 4...).
Working code for one argument - word you can find below. What I need now is to have possibility to insert more than one word so it could be replaced in code by special signs.
def cenzura(text, word, sign="#"):
if word in text:
return text.replace(word, len(word)*sign)
else:
return text
cenzura("The day when I left", "day", sign="$")