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

后端 未结 11 2124
名媛妹妹
名媛妹妹 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:35

    I have been using pyflakes successfully and wished to auto-remove the unused imports.

    I recently found autoflake:

    • Uses pyflakes for checking.
    • Defaults to removing unused standard library imports and redundant pass statements.
    • Has options for removing other unused imports and unused variables.

提交回复
热议问题