Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16720 > unrolled thread

Re: whitespace cleanup

Started byAndrea Crotti <andrea.crotti.0@gmail.com>
First post2011-12-06 11:59 +0000
Last post2011-12-06 11:59 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: whitespace cleanup Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-12-06 11:59 +0000

#16720 — Re: whitespace cleanup

FromAndrea Crotti <andrea.crotti.0@gmail.com>
Date2011-12-06 11:59 +0000
SubjectRe: whitespace cleanup
Message-ID<mailman.3342.1323172811.27778.python-list@python.org>
On 12/06/2011 11:49 AM, Pedro Henrique G. Souto wrote:
> On 06/12/2011 09:28, Andrea Crotti wrote:
> > Now on Emacs I have a hook before every save that cleans up all the
> > "wrong" white spaces,
> > with the 'whitespace-cleanup' function.
> >
> > I would like that also for my non emacsers colleagues, and possibly 
> with
> > a Python script.
> > I looked up around but I can't find anything useful, any advice?
>
> You can use the strip() method: 
> [http://docs.python.org/release/2.3/lib/module-string.html]
>
> While reading the file as strings, the strip() method rips out all of 
> the extra whitespace.
>
> > Thanks,
> > Andrea
> >
>
> Good luck!
>

Well it's not so simple, I clearly don't want to strip out whitespace in 
the beginning of the line,
or my nice code will break miserably ;)

So I think some magic using tokens/regexp/python grammar would be useful 
to do something
reliable, or is it easier than that?

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web