<div>Hello</div><div><br></div><div>I ran across this accidentally and wonders how to make the doctest in following code snippet work:<br clear="all"></div><div><br></div><div><br>import doctest <br>
<br>def a(): <br>
""" <br> >>> a = '\\r\\n' <br>
>>> print a </div><div><br></div><div><br></div><div> No matter how many blank lines I add here, it just can't get enough -_-<br>
""" <br> pass <br>
<br>doctest.testmod() <br></div><div><br></div><div><br></div><div><br></div><div>
ps: I want variable "a" to be '\r\n', but python kept telling me</div><div> ValueError: line 4 of the docstring has inconsistent leading whitespace: "'"</div><div> Why can't doctest module deal with statement "a='\r\n'"?</div>
<div><br></div>-- <br>Luyun Xie<br><a href="http://magefromhell.blogspot.com/">http://magefromhell.blogspot.com/</a><br>(<a href="http://blog.hellmage.info/">http://blog.hellmage.info/</a>)<br>