1string = "Hello, world! Some more text here..." # Just a string
2string.replace(" ", "") # Replaces all instances of " " (spaces)with "" (nothing)
3
4# string is now "Hello,World!Somemoretexthere..."
5# I hope I helped you! ;)
1import re
2s = '\n \t this is a string with a lot of whitespace\t'
3s = re.sub('\s+', '', s)
1## Remove the Starting Spaces in Python
2
3string1=" This is Test String to strip leading space"
4print (string1.lstrip())
5