Strip Characters From a Python String - Real Python
Use Python's .strip(), .lstrip(), .rstrip() to remove whitespace or specified characters from string ends; use .removeprefix()/.removesuffix() for exact sequences.
Strip Characters From a Python String Quiz - Real Python
Use strip, lstrip, and rstrip to remove whitespace or specified characters from string ends and choose the appropriate method for the desired trimming.