Remove leading and trailing slash / in python January 9, 2023 by Tarik >>> "/get/category".strip("https://stackoverflow.com/") 'get/category' strip() is the proper way to do this.