>>> " xyz ".rstrip()
' xyz'
import re
my_string = " Hello Python "
output = re.sub(r'^s+|s+$', '', my_string)
print(output)
sentence = ' hello apple'
" ".join(sentence.split())
>>> 'hello apple'
>>> ' hello world! '.strip() #remove both
'hello world!'
>>> ' hello world!'.lstrip() #remove leading whitespace
'hello world!'
vals_inp=input()
list_set = list(vals_inp)
vals = [x for x in list_set if x != ' ']
set_vals = set(vals)
Use the lstrip() method
>>> name = ' Steve '
>>> name
' Steve '
>>> name = name.lstrip()
>>> name
'Steve '