How can I check for unused import in many Python files?

后端 未结 11 2110
名媛妹妹
名媛妹妹 2020-12-13 01:58

I remember when I was developing in C++ or Java, the compiler usually complains for unused methods, functions or imports. In my Django project, I have a bunch of Python fil

11条回答
  •  攒了一身酷
    2020-12-13 02:24

    I agree with using PyFlakes. It's like linting, but it excludes styling errors.

    UPDATE

    How to run: pyflakes or pyflakes

    BE CAREFUL!!!

    If you run it just with command pyflakes, it takes a really long time like it is never-ending. My hypothesis is it is trying to check every python file in your machine/folder when you call it that way.

提交回复
热议问题