how to replace spaces in a string with + python code example Example: replacing spaces in a string python mystring.replace(" ", "_")