Auto Fix Indentation Problem for Python code

Use autopep8, on Ubuntu you may need install autopep8 using the follow method,
sudo python -m easy_install autopep8
# dry run, does not do real changing
autopep python_script.py 
# format the code; it is a good idea to back up your code before executing
autopep8 -i python_script.py 
Please note if you run the following command to install autopep8, you may end up getting the wrong package pep8 which check the formatting only.
sudo apt-get install pep8

No comments:

Post a Comment

Datatable static image not found on the server

When you use ```datatables.min.css``` and ```datatables.min.js``` locally, instead of datatables CDN, you may have encountered that ```sort...