Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Python by (16.4k points)

On Python 3.x, the string.replace() is deprecated . What is the better approach for doing this?

1 Answer

0 votes
by (26.4k points)

In 2.x, You can use str.replace()

For example:

>>> 'Hello world'.replace('world', 'Guido')

'Hello Guido'

Are you looking for a good python tutorial? Join the python course fast and gain more knowledge in python.

To know more about this you can have a look at the following video tutorial:-

Related questions

0 votes
1 answer
asked Sep 20, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jan 5, 2021 in Python by laddulakshana (16.4k points)
0 votes
1 answer

Browse Categories

...