Possible to include \n chars in doctest code samples or output?

python at bdurham.com python at bdurham.com
Fri Jul 16 01:26:40 EDT 2010


Thomas,

> Recall that doctest doesn't parse the code, it extracts the docstrings. And docstrings are just strings, and are parsed like strings.

I understand what you're saying, but I'm struggling with how to
represent the following strings in doctest code and doctest results. No
matter what combination of backslashes or raw strings I use, I am unable
to find a way to code the following.

>>> encode( '", \, \t, \n' )
'\", \\, \\t, \\n'

Thank you,
Malcolm



More information about the Python-list mailing list