python - Find and replace text in string -


this question has answer here:

how can https://onion-rip.de from

https://onion-rip.de/data/images/9d5faef5c26f69546f8/68c8a2a5fe0a9c5c221a2bb.jpg

and replace https://test.de. output should be:

https://test.de/data/images/9d5faef5c26f69546f8/68c8a2a5fe0a9c5c221a2bb.jpg

is special function in python this?

you can use python's replace() method this:

oldurl = 'https://onion-rip.de/data/images/9d5faef5c26f69546f8/68c8a2a5fe0a9c5c221a2bb.jpg' newurl = oldurl.replace('https://onion-rip.de', 'https://test.de') print(newurl) 

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -