#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
Курс по программированию на Питоне
En esta página del sitio puede ver el video en línea Как применять функцию replace() к строкам в Python? Метод replace() в Python. de Duración hora minuto segunda en buena calidad , que subió el usuario Olga Soboleva 04 julio 2020, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 1,686 veces y le gustó 41 a los espectadores. Disfruta viendo!