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