Python String replace() Method
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.
old : An old string which will be replaced.
new : New string which will replace the old string.
count : The number of times to process the replace.
It returns string
Let's see some examples of replace() method to understand it's functionality.
Python String replace() Method Example 1
Old String: Java is a programming language New String: C is a programming language
Python String replace() Method Example 2
Old String: Java C C# Java Php Python Java New String: C# C C# C# Php Python C# Old String: Java C C# Java Php Python Java New String: C# C C# Java Php Python Java
Python String replace() Method Example 3
Tomato is also a fruit
JavaTpoint offers too many high quality services. Mail us on [email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected]
Duration: 1 week to 2 week