On Thu, 14 Dec 2017 09:08 pm, ayaskant.mantu...@gmail.com wrote: > Hi, > > I want to replace the spaces in a sting with hyphen with my own replace > function or with using the pre-defined replace function. Can anybody help me > with this issue???
new_string = "string with spaces".replace(" ", "hyphen") When in doubt, open the Python interpreter to a command prompt ">>> " and enter: help("") to see the string methods. Other commands work too: help(str.replace) -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list