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