> Programming Languages > Python
Various Topics Home | Disclaimer | Report Adult Posts

Various Topics on Python



Python - "Strip white spaces from source" in Programming Languages


Old 05-09-2005   #1
..weee.. ..hoo...
 
Default Strip white spaces from source

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_stac k,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.

 

Thread Tools
Display Modes





Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0