To replace blanks in a string in Python you can use the following snippet.

Sample Python

stringOne = "This is a teststring"  
stringTwo = stringOne.replace(" ", "")

2 thought on “How to replace blanks in a string in Python”

Leave a Reply