doctest Hassles!
Andrew Dalke
dalke at dalkescientific.com
Tue Mar 12 13:34:46 EST 2002
Douglas Garstang:
> when I print the value of ls, I get:
>
>'
> example.py
> example.pyc
> tester.py
>
>'
>
>Notice the blank line at the end. Where did that come from?
The print statement adds its own newline to the end. Instead,
try it without the print.
>>> import os
>>> ls=os.popen("/bin/ls","r").read()
>>> ls
example.py
example.pyc
tester.py
>>>
I've also found it useful to end the doctest with an empty '>>>'.
Andrew
dalke at dalkescientific.com
More information about the Python-list
mailing list