textwrap.dedent replaces tabs?

CakeProphet adamadamadamamiadam at gmail.com
Sat Dec 16 18:11:02 EST 2006


Hmmm... a quick fix might be to temporarily replace all tab characters
with another, relatively unused control character.

MyString = MyString.replace("\t", chr(1))
MyString = textwrap.dedent(MyString)
MyString = MyString.replace(chr(1), "\t")

Of course... this isn't exactly safe, but it's not going to be fatal,
if it does mess something up. As long as you don't expect receiving any
ASCII 1 characters.




More information about the Python-list mailing list