to remove spacesusing regex in python\ code example
Example 1: remove after and before space python
st = " a "
strip(st)
#Output : "a"
Example 2: how to remove spaces in string in python
sentence = ' hello apple '
sentence.strip()
>>> 'hello apple'