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