python string replace
Python hosting: Host, run, and code Python in the cloud!
The method replace returns a new string with old replaced by new.
Syntax
The format is:
str.replace(old, new, max) |
Parameters
| Parameter |
|---|
| old The string to be replaced |
| new The string to be used |
| max Maximum amount of replacements.Leave blank for infinite. |
s = "All work and no play makes Jack a dull boy. Jack?" |
Result:
All work and no play makes Joe a dull boy. Joe?
Posted in Documentation
Leave a Reply: