Is there any way to replace multiple different characters to another with a single .replace command?
Currently, I'm doing it once per line or through a loop:
UserName = input("Enter in Username:")
UserName = UserName.replace("/", "_")
UserName = UserName.replace("?", "_")
UserName = UserName.replace("|", "_")
UserName = UserName.replace(":", "_")
print(UserName)
#Here's the second way- through a loop.
Word = input("Enter in Example Word: ")
ReplaceCharsList = list(input("Enter in replaced characters:"))
for i in range(len(ReplaceCharsList)):
Word = Word.replace(ReplaceCharsList[i],"X")
print(Word)
Is there a better way to do this?