How to replace blanks in a string in Python

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

Sample Python

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

Please Share us:
Please rate this snippet

2 thoughts on “How to replace blanks in a string in Python

Leave a Reply