python strim trim

Solutions on MaxInterview for python strim trim by the best coders in the world

showing results for - "python strim trim"
Rebeca
21 Apr 2016
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'