[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [SPAM: 3.500] Re: [pygame] This one baffles me



umm... well i got my editor to display spaces and tabs differently (tabs with an arrow) so i can see where i've accidentally used spaces.

thanks anyway

--- On Mon, 5/18/09, Nicholas Dudfield <ndudfield@xxxxxxxxx> wrote:

From: Nicholas Dudfield <ndudfield@xxxxxxxxx>
Subject: Re: [SPAM: 3.500] Re: [pygame] This one baffles me
To: pygame-users@xxxxxxxx
Date: Monday, May 18, 2009, 9:12 AM

jug wrote:
> I think you forgot the newline:
>   .replace("\n"+" "*4, "\n\t")
>
No cigar... not even close...

from __future__ import with_statement

with open ('perforce_plugin.py', 'r+w') as fh:
   fixed_tabs = fh.read().expandtabs(4)
   fh.seek(0)
   fh.write(fixed_tabs)

*expandtabs*(s, tabsize=8)
   expandtabs
   <http://pydoc.org/1.6/string.html#-expandtabs>(s [,tabsize]) -> string
       Return a copy of the string s with all tab characters replaced
   by the appropriate number of spaces, depending on the current
   column, and the tabsize (default 8).