1' hello world! '.strip()
2'hello world!'
3
4
5' hello world! '.lstrip()
6'hello world! '
7
8' hello world! '.rstrip()
9' hello world!'
1a = " yo! "
2b = a.strip() # this will remove the white spaces that are leading and trailing
1
2s1 = ' abc '
3
4print(f'String =\'{s1}\'')
5
6print(f'After Removing Leading Whitespaces String =\'{s1.lstrip()}\'')
7
8print(f'After Removing Trailing Whitespaces String =\'{s1.rstrip()}\'')
9
10print(f'After Trimming Whitespaces String =\'{s1.strip()}\'')
11