sublimetext2 - Clean Python code with Sublime -


i clean long python code:

  • indentations (sometimes used 2 whitespaces, 4 whitespaces), have 4 everywhre

  • sometimes have unwanted whitespaces @ end of line :
    print "hello" <eol>

using sublime text's edit > line > reindent doesn't work python. example: doing on:

for in range(27):     if == b:         print print "finished" 

would give

for in range(27):     if == b:         print         print "finished" 

which not same thing!

what use beautify python code?

you can use autopep8 : https://pypi.python.org/pypi/autopep8/

$ autopep8 --in-place --aggressive <filename> 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -