#pythonпорусски #функцияreplace #методreplace #строкивpython
Упражнения:
1. Замените maturing sun на waning moon в данной строке:
p = 'Season of mists and mellow fruitfulness, close bosom-friend of the maturing sun'
2. Замените все буквы n буквой W в данной строке:
p = 'Season of mists and mellow fruitfulness, close bosom-friend of the maturing sun'
3. Замените king's на queen's в данной строке:
hd = 'All the king's horses and all the king's men couldn't put Humpty together again'
3. Замените все пробелы восклицательными знаками в данной строке:
hd = 'All the king's horses and all the king's men couldn't put Humpty together again'
______________________________________________________________________________________
Метод replace() это функция, которая ищет и заменяет любой символ или фрагмент строки.
Пример:
s = 'Beleet parus odinokiy'
Заменяем:
Beleet на Krasneet
Beleet parus на On
odinokiy на v tumane morya
e на X
Все пробелы на @
Курс №2 по программированию на Python 7
Python course in Russian
Курс по программированию на Питоне
Nesta página do site você pode assistir ao vídeo on-line Как применять функцию replace() к строкам в Python? Метод replace() в Python. duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Olga Soboleva 04 Julho 2020, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 1,686 vezes e gostou 41 espectadores. Boa visualização!