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

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -