s = ' This is a sentence with whitespace.
'
print('Strip leading whitespace: {}'.format(s.lstrip()))
print('Strip trailing whitespace: {}'.format(s.rstrip()))
print('Strip all whitespace: {}'.format(s.strip()))
# Output
# Strip leading whitespace: This is a sentence with whitespace.
# Strip trailing whitespace: This is a sentence with whitespace.
# Strip all whitespace: This is a sentence with whitespace.