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

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



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).