File: class/Workbook/Examples/Lecture13/replace.py

# global substitution

def replace(str, old, new): 
    list = str.split(old)          # XoldY -> [X, Y]
    return new.join(list)          # [X, Y] -> XnewY



[Home page] Books Code Blog Python Author Train Find ©M.Lutz