1string =' abc '
2
3# After removing leading whitespace
4print(string.lstrip());
5# Output: 'abc '
6
7# After removing trailing whitespace
8print(string.rstrip());
9# Output: ' abc'
10
11# After removing all whitespace
12print(string.strip());
13# Output: 'abc'
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