textwrap.dedent replaces tabs?

Tom Plunket tomas at fancy.org
Sat Dec 16 15:26:47 EST 2006


The documentation for dedent says, "Remove any whitespace than can be
uniformly removed from the left of every line in `text`", yet I'm
finding that it's also modifying the '\t' characters, which is highly
undesirable in my application.  Is there any way to stop it from doing
this, or alternatively, to put those tabs back in?

I see that TextWrap and its member functions take an 'expand_tabs'
kwarg, but dedent unfortunately does not.

...I suppose such a function (replacement dedent) isn't terribly tough
to write, but it seems an odd default especially considering there's no
way to turn off the undesired changes, but were the changes /not/ made,
the same text could just be passed through TextWrapper and have them
removed...

thx,
-tom!

-- 



More information about the Python-list mailing list