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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -