Ahem: http://yellow.bikeshed.com/
There's no need for everyone to jump in and start offering solutions
to a simple problem. There's lots of different ways to solve it.
People have different opinions on what is the best way. But
irregardless, I'm pretty sure the GP knows how to do it now.
-Tyler
On Mon, May 18, 2009 at 7:12 AM, Nicholas Dudfield
<ndudfield@xxxxxxxxx <mailto:ndudfield@xxxxxxxxx>> wrote:
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).
--
Visit my blog at http://oddco.ca/zeroth/zblog