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