|
|
|
|
|
by jbay808
2413 days ago
|
|
I don't know about you, but when I search for "python string replace" I'd expect the first result to be the Python 3 documentation for 'string'. Instead, I get (in order): 1. GeeksforGeeks 2. Tutorialspoint 3. W3Schools 4. Programiz 5. Stack overflow 6. And then, finally, the official documentation... For python 2.7. How does this happen? Are these sites just paying Google a bunch for the rankings? |
|
The documentation for str.replace is located halfway down an enormous page that describes every single built-in type in the language [1].
And then, once you manage to find the entry for str.replace, what does it tell you?
Return a copy of the string with all occurrences of substring old replaced by new. If the optional argument count is given, only the first count occurrences are replaced.
That's it. No examples, no link to re.sub or other functions you might want to use for replacement. Stack Overflow or even W3Schools (gasp!) is much better results for this.
[1] https://docs.python.org/3/library/stdtypes.html