1a = " smurf "
2
3a = a.strip()
4#remove space at begining and end of string
5print(a)
6#smurf
1# Leading and trailing whitespaces are removed
2text1 = ' Python Programming '
3print(text1.strip())
4
5
6# Remove the whitespace and specified character on
7# both leading and trailing end
8text3 = ' code its my code '
9print(text3.strip(' code'))
10
11# Remove the specified character at
12# both leading and trailing end
13text2 = 'code its my code'
14print(text2.strip('code'))