python substitute multiple letters
message = "h@ll$ w$rld" # make the replacement ('!'->'a', '@'->'e', etc.) message.translate(str.maketrans("!@#$%", "aeiou")) # outputs hello world
python substitute multiple letters
message = "h@ll$ w$rld" # make the replacement ('!'->'a', '@'->'e', etc.) message.translate(str.maketrans("!@#$%", "aeiou")) # outputs hello world
python string replace letters with numbers
from string import ascii_letters code = code = "1111702460830000Lu05" code = "".join([str(ascii_letters.index(c)) if c in ascii_letters else c for c in code]) print(code)
replace multiple characters in a string
// Replace multiple characters in a string fn main() { // Clumsy way let s = "The quick (brown) fox jumps over the lazy dog's back, and "runs" away; without barking: crazy."; let s = s.replace("(", ""); let s = s.replace(")", ""); let s = s.replace(",", ""); let s = s.replace(""", ""); let s = s.replace(".", ""); let s = s.replace(";", ""); let s = s.replace(":", ""); let s = s.replace("'", ""); println!("{}", s); // Better way let s = "The quick (brown) fox jumps over the lazy dog's back, and runs away; without barking: crazy."; let s = s.replace(&['(', ')', ',', '"', '.', ';', ':', '''][..], ""); println!("{}", s); }
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us