Replace part of a string in Python?

python, string

Solution

>>> stuff = "Big and small"
>>> stuff.replace(" and ","/")
'Big/small'

Problem

I used regular expressions to get a string from a web page and part of the string may contain something I would like to replace with something else. How would it be possible to do this? My code is this, for example: ``` stuff = "Big and small" if stuff.find(" and ") == -1: # make stuff "Big/small" else: stuff = stuff ```

Original source