Comment

Eric Werner

Whow nice! I didn't even know that `.startswith()/.endswith()` eat tuples!! 👍 Thanks!

But you didn't consider using `os.path.splitext()`? And then compare if in list?
What about lowercasing it before? To match accidentally upper cased extensions?

Replies

Peter Bengtsson

os.path.splitext will say the extension is .gz for both foo.tar.gz and foo.gz and I needed it to be more specific.
Lowercasing would be the same across the board.

Yeah, that tuple trick on endswith is nice.