NetEase cloud the classroom curriculum link address
Python replace () method
description
Python replace () method of the string old (old string) replaced with new (new string), if the third argument max, max is not more than the replacement times.
grammar
replace () method syntax:
str.replace(old, new[, max])
parameter
- old - substring to be replaced.
- new - new string for replacing old substring.
- max - optional string, alternatively no more than max times
return value
Returns string old (old string) replaced with a new string generated after the new (new string), if the third argument max, max is not more than the replacement times.
Examples
The following examples illustrate replace () function using the method:
Examples of the above output results are as follows:
thwas was string example....wow!!! thwas was really string
thwas was string example....wow!!! thwas is really string
eg
-
https://study.163.com/provider/400000000398149/index.htm?share=2&shareId=400000000398149 (video bloggers teaching Home)
Micro-channel scan two-dimensional code, free resources to learn more python