Pretty Printing Like Tidy for HTML

D

David

All,

Is there a pretty printing utility for Python, something like Tidy for
HTML?

That will change:

xp=self.uleft[0]+percentx*(self.xwidth)

To:

xp = self.uleft[0] + percentx * (self.xwidth)

And other formatting issues.
 
D

Daniel

All,

Is there a pretty printing utility for Python, something like Tidy for
HTML?

That will change:

xp=self.uleft[0]+percentx*(self.xwidth)

To:

xp = self.uleft[0] + percentx * (self.xwidth)

And other formatting issues.

Why not just write python as it should be written?
 
T

Thomas Wittek

Daniel:
Why not just write python as it should be written?

Oh, you write all the code you use yourself?
It's relatively common that you have some "legacy" code (e.g. from
(ex-)colleages) that doesn't conform to your style preferences/your
companys coding guidelines.
In such a case those tools can be very helpful.
 
J

John J. Lee

B

bsneddon

David said:
Is there a pretty printing utility for Python, something like Tidy for
HTML?
That will change:
xp=self.uleft[0]+percentx*(self.xwidth)

xp = self.uleft[0] + percentx * (self.xwidth)
And other formatting issues.

Googled and found these; no idea if they're any good (latter is
commercial):

http://cheeseshop.python.org/pypi/PythonTidy/1.11

http://python.softalizer.com/

See also:

http://svn.python.org/view/python/trunk/Tools/scripts/reindent.py?vie...

John

I did this useing the BeautifulSoup module.
Used it on XML created by msWord which had no formating was
all on one line.
 
B

bsneddon

David said:
Is there a pretty printing utility for Python, something like Tidy for
HTML?
That will change:
xp=self.uleft[0]+percentx*(self.xwidth)
To:
xp = self.uleft[0] + percentx * (self.xwidth)
And other formatting issues.
Googled and found these; no idea if they're any good (latter is
commercial):


See also:

John

I did this useing the BeautifulSoup module.
Used it on XML created by msWord which had no formating was
all on one line.

Sorry, I answered the wrong question.
You wanted to format code not HTML.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top