I need help with a program I\'m making in Python.
Assume I wanted to replace every instance of the word \"steak\" to \"ghost\" (just go wit
\"steak\"
\"ghost\"
Use the count variable in the string.replace() method. So using your code, you wouold have:
string.replace()
s="The scary ghost ordered an expensive steak" print s s=s.replace("steak","ghost", 1) s=s.replace("ghost","steak", 1) print s
http://docs.python.org/2/library/stdtypes.html