str.strip() removes more than you asked
strip("https://") does not remove that word. It removes any of the characters h, t, p, s, : and / from both ends until it meets one that is not in the set.
What it means
The argument to strip(), lstrip() and rstrip() is a set of single characters, not a substring. So "https://shop.com".strip("https://") keeps going past the prefix and eats the s and h of shop. Python 3.9 added removeprefix() and removesuffix() for exact text.
Common causes
1. Removing a URL prefix
The domain's first letters may be in the character set.
Breaks
url.strip("https://") # 'op.com'Works
url.removeprefix("https://") # 'shop.com'2. Removing a file extension
Letters of the name that are also in the extension disappear.
Breaks
"data.txt".rstrip(".txt") # 'data' by luck; 'test.txt' -> 'tes'Works
"test.txt".removesuffix(".txt") # 'test'How to find it in your own code
Use strip() with no argument for whitespace, and removeprefix()/removesuffix() for exact text. For file names, pathlib.Path(name).stem and .suffix are more robust still.
Still not sure why yours breaks?
Paste it into the visualizer and watch it run line by line, with every variable at every step. Free, and it runs in your browser.