I am learning Python 3 so that I can use it in my PhD thesis project. I've been using the official documentation to learn about what the various Python functions do but I still don't understand what the part between the brackets means []
in some of the arguments that the functions receive. To be more specific, what does it mean [, count]
in str.replace(old, new[, count])
?
I attach the documentation to the replace function: link
The count is how many times you want the search word to be changed.
In this example replace "geeks" with "GeeksforGeeks" 3 times
I think what has confused you is the ',' which means that what you want to be replaced in the string would go there.
EDIT:
As @Patricio Moracho says and I forgot to tell you: