Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.048 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'python': 0.08; 'advice?': 0.09; 'method:': 0.09; 'useful,': 0.15; 'cleans': 0.16; 'whitespace.': 0.16; 'looked': 0.16; 'wrote:': 0.18; 'thanks,': 0.18; 'possibly': 0.19; 'header:In-Reply-To:1': 0.22; 'script.': 0.29; 'strings,': 0.30; "can't": 0.32; 'message-id:@gmail.com': 0.33; 'header:User-Agent:1': 0.33; 'to:addr:python-list': 0.34; 'anything': 0.34; 'function.': 0.34; 'url:python': 0.36; 'file': 0.36; 'received:209.85.161': 0.36; 'but': 0.37; 'received:192': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'non': 0.38; 'url:docs': 0.39; 'url:org': 0.39; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'received:192.168': 0.40; 'url:3': 0.67; 'andrea': 0.84; 'hook': 0.84; 'url:lib': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=Nkw9DVSd6yBbndsCUSlJLQO4D9dyhcu47kGcNH25MoI=; b=mgWP2GWyB+iSBvqvgbVyH9rxjD4Pki7HPNUMyj6d9HvfSbOuxW2VtUaxq2s4uhQrEM e1wFeDlfM3zPnPRV0THUvcjAZF9f+5HYoIKyAh6y9UifFutu/F/55KYjUKhYzsCp/oSO BKpWn/6Rsz4LXG7iEFcazGdsoSdwtGbUh89XA= Date: Tue, 06 Dec 2011 09:49:58 -0200 From: "Pedro Henrique G. Souto" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: whitespace cleanup References: <4EDDFC48.2000903@gmail.com> In-Reply-To: <4EDDFC48.2000903@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1323172211 news.xs4all.nl 6853 [2001:888:2000:d::a6]:53539 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:16719 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! -- Att; Pedro Henrique G. Souto