0
question about replace() method
What is the meaning of 2 in this one line code ? https://code.sololearn.com/cia11smGV1Yx
4 Respostas
+ 4
It's how many times it's replacing. In your example, it'll replace the first 2 'i' chars with 'z' which is why the remaining 'i' chars weren't replaced. Change the number to 4 and run it again, it should replace the other two 'i' chars with 'z' also.
+ 6
Here's the official blurb on the built in string methods
https://docs.python.org/3/library/stdtypes.html#string-methods
+ 4
Btw, I forgot to mention, if you omit that argument altogether, it'll replace all instead of only replacing a certain amount of times.
+ 1
perform the replace twice.