How do we replace a character in a string with some other ? | Sololearn: Learn to code for FREE!
0

How do we replace a character in a string with some other ?

eg. We have string "This is String". Now if we want to replace "S" with "

#x27;. and want to receive "This. Is $tring" as output. How can we do this ??

28th Feb 2020, 6:14 PM
Jatin Kumar
Jatin Kumar - avatar
1 Odpowiedź
+ 3
string="this is string" print(string.split()[0]+" "+string.split()[1] +" ",end="") print(string.split()[2].replace("s","
quot;))
29th Feb 2020, 2:24 AM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar