Answers for "python 3.10 replace multiple characters in a string"

3

python substitute multiple letters

message = "h@ll$ w$rld"
# make the replacement ('!'->'a', '@'->'e', etc.)
message.translate(str.maketrans("!@#$%", "aeiou"))
# outputs hello world
Posted by: Guest on May-26-2021

Code answers related to "python 3.10 replace multiple characters in a string"

Python Answers by Framework

Browse Popular Code Answers by Language