python change spaces to underscore code example Example: space to underscore python mystring.replace(" ", "_")