how to replace something in a string python with space code example Example: space to underscore python mystring.replace(" ", "_")