str replace all spaces to + pythin code example
Example 1: space to underscore python
mystring.replace(" ", "_")
Example 2: how to remove spaces in string in python
sentence = ' hello apple '
sentence.strip()
>>> 'hello apple'
mystring.replace(" ", "_")
sentence = ' hello apple '
sentence.strip()
>>> 'hello apple'