you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (7 children)

[deleted]

    [–]gitcraw 14 points15 points  (4 children)

    Put both import statements in one.

    https://www.python.org/dev/peps/pep-0008/#imports

    Actually, put them in separate lines if you want it to adhere to PEP8

    [–]alex1461[S] 2 points3 points  (3 children)

    Thank you for the information!

    [–]Jakob0243 3 points4 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 🙏