Various behaviors of doctest

Gnarlodious gnarlodious at gmail.com
Wed Mar 2 11:02:47 EST 2011


On Feb 28, Peter Otten wrote:

> Are you using Python 2.x? Then you cannot redefine print. Instead you have
> to redirect stdout. The following example should run as a cgi script:
>
> #!/usr/bin/env python
> import cgi
> import sys
> from cStringIO import StringIO
...

That works! Except for Py3 I had to say:

from io import StringIO

Thanks.

-- Gnarlie



More information about the Python-list mailing list