Skip to content
Advertisement

Is there a way to remove unused imports for Python in VS Code?

I would really like to know if there is some Extension in Visual Studio Code or other means that could help identify and remove any unused imports.

I have quite a large number of imports like this and it’s getting close to 40 lines. I know some of them aren’t in use, the problem is removing them safely.

JavaScript

Advertisement

Answer

Go to the User Settings json file and add the following:

JavaScript

This should remove the unused python imports automatically.

More suggestions here: How can I check for unused import in many Python files?

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement