Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you format python code in Visual Studio Code?

Opened a ticket with AutoPep8, but when I installed the autopep8 extension, it doesn't seem to find the module. When I change the config to tell it where it is a format doesn't do anything. Formating in terminal does however. Any ideas? https://github.com/hhatto/autopep8/issues/349#issuecomment-335662565

like image 235
Dan Quackenbush Avatar asked Nov 21 '25 01:11

Dan Quackenbush


2 Answers

Install the below python packages for Python Code Format supporting in Windows

pip install autopep8

pip install pylint

Once you have successfully installed the packages, Open the code in vs code -> Press Ctrl + A and Ctrl + K, it will format the code.

like image 107
Dhandapani Sudhakar Avatar answered Nov 23 '25 16:11

Dhandapani Sudhakar


autopep8 is listed as a requirement. On mac, using brew, you can install it as follows:

brew install autopep8
like image 34
Sybrand Avatar answered Nov 23 '25 16:11

Sybrand



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!