Answer the question
In order to leave comments, you need to log in
replace doesn't work. I would be glad to help (without "learn python")?
I want to make a bot that encrypts a message, but replace() does not work
sh_txt = data['sh_txt']
shifr = ''
shifr += sh_txt
shifr.replace('А', "Г")
shifr.replace('а', 'г')
shifr.replace('Б', "Д")
shifr.replace("б", "д")
shifr.replace("В", "Е")
.............................
#и так далее
await msg.answer(f'{shifr}', reply_markup=gens)
Answer the question
In order to leave comments, you need to log in
shifr = 'АаБбВ'
mapping = {
'А': 'Г',
'а': 'г',
'Б': 'Д',
'б': 'д',
'В': 'Е'
}
table = str.maketrans(mapping)
shifr = shifr.translate(table)
It is necessary not to search in Google, but to read the textbook.
PS We don't need to be told what to say.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question