Strip white spaces from source

William Park opengeometry at yahoo.ca
Tue May 10 12:26:04 EDT 2005


qwweeeit at yahoo.it wrote:
> Hi all,
> I need to limit as much as possible the lenght of a source line,
> stripping white spaces (except indentation).
> For example:
> .   .   max_move and AC_RowStack.acceptsCards ( self, from_stack, cards
> )
> must be reduced to:
> .   .   max_move and AC_RowStack.acceptsCards(self,from_stack,cards)
> 
> My solution has been (wrogly): ''.join(source_line.split())
> which gives:
> max_moveandAC_RowStack.acceptsCards(self,from_stack,cards)
> 
> Without considering the stripping of indentation (not a big problem),
> the problem is instead caused by the reserved words (like 'and').
> 
> Can you help me? Thanks.

Perhaps, you can make indent(1) do what you want.  It's designed for C
program, but...

-- 
William Park <opengeometry at yahoo.ca>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
           http://home.eol.ca/~parkw/thinflash.html



More information about the Python-list mailing list