# L-14 MCS 275 Fri 12 Feb 2010 : substitute.py def subs(s,x,y): """ Replaces all occurrences of x in the string s by y. """ L = s.split(x) return y.join(L) def main(): """ Prompts user for string and two symbols. """ s = raw_input("Give a string : ") x = raw_input(" what to replace : ") y = raw_input("replacement string : ") r = subs(s,x,y) print "the new string \"%s\"" % r main()