trim python 3 string code example
Example: python string trim
string =' abc '
# After removing leading whitespace
print(string.lstrip());
# Output: 'abc '
# After removing trailing whitespace
print(string.rstrip());
# Output: ' abc'
# After removing all whitespace
print(string.strip());
# Output: 'abc'