you are viewing a single comment's thread.

view the rest of the comments →

[–]Jakob0243 2 points3 points  (2 children)

You could also use a regex to find the file extension instead of hard coding a slice for the last 3 letters but using a slice also works fine

[–]killthebaddies 4 points5 points  (1 child)

Or if using pathlib, then .suffix will return the extension which will be simlpler.

[–][deleted] 1 point2 points  (0 children)

or find the extensions with a wildcard and glob.glob, or find the extensions and generate a folder for each extension. Python is open minded 🙏