Skip to content

Instantly share code, notes, and snippets.

@raeq
Created July 19, 2020 09:08
Show Gist options
  • Save raeq/9f8266b64ff6af2d3d493c99228de66a to your computer and use it in GitHub Desktop.
Save raeq/9f8266b64ff6af2d3d493c99228de66a to your computer and use it in GitHub Desktop.
Returns a tuple of string stripped
def strip_it(input_string: str) -> tuple:
return (input_string.lstrip(), input_string.rstrip(), input_string.strip())
left, right, full = strip_it(" A padded string ")
assert left == "A padded string "
assert right == " A padded string"
assert full == "A padded string"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment