Python String entfernen Sie Weiße und Neulinge
' '.join(myString.split())
Index out of bounds
' '.join(myString.split())
st = " a "
strip(st)
#Output : "a"
a = " yo! "
b = a.strip() # this will remove the white spaces that are leading and trailing
## Remove the Starting Spaces in Python
string1=" This is Test String to strip leading space"
print (string1.lstrip())
import re
s = '\n \t this is a string with a lot of whitespace\t'
s = re.sub('\s+', '', s)
>>> s.strip()
'Hello World From Pankaj \t\n\r\tHi There'