human
How do I replace whitespaces with underscore and vice versa?
assistant
Here is some code to replace spaces with underscore

mystring.replace(' ', '_')

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.