2007年06月24日 星期日 21:29
大家好,我是 python 新手。想在 python 中用 print 输出调试信息,不知 道有没有类似 C 语言中的 #ifdef DEBUG ...... #endif 然后 cc -DDEBUG ... 就可以产生调试信息。如果没有,那在 python 中如何调试?谢谢! -- ssSslang
2007年06月24日 星期日 22:13
On 6/24/07, ssSslang <sssslang在163.com> wrote: > > 大家好,我是 python 新手。想在 python 中用 print 输出调试信息,不知 > 道有没有类似 C 语言中的 > > #ifdef DEBUG > ...... > #endif > > 然后 > > cc -DDEBUG ... > > python有标准的logging包: http://docs.python.org/lib/module-logging.html http://www.onlamp.com/pub/a/python/2005/06/02/logging.html http://antonym.org/node/76 BTW: 就算没有logging, 也可以用unit test啊 :) -- simple is good http://brucewang.net skype: number5 -------------- 下一部分 -------------- 一个HTML附件被移除... URL: http://python.cn/pipermail/python-chinese/attachments/20070624/d5423f36/attachment.html
2007年06月24日 星期日 23:20
if debug:
...
就行,不过这段代码不能通过某个编译选项被编译器忽略。
On 6/24/07, ssSslang <sssslang at 163.com> wrote:
>
> 大家好,我是 python 新手。想在 python 中用 print 输出调试信息,不知
> 道有没有类似 C 语言中的
>
> #ifdef DEBUG
> ......
> #endif
>
> 然后
>
> cc -DDEBUG ...
>
> 就可以产生调试信息。如果没有,那在 python 中如何调试?谢谢!
>
> --
> ssSslang
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
--
http://codeplayer.blogspot.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20070624/b6630c67/attachment.html
2007年06月25日 星期一 20:07
谢谢两位! "黄毅" <yi.codeplayer在gmail.com> writes: > if debug: > ... > > 就行,不过这段代码不能通过某个编译选项被编译器忽略。 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 不过这句话还是不大明白。 debug 这个变量用事先赋值吗? "Bruce Wang" <number5在gmail.com> writes: > python有标准的logging包: > http://docs.python.org/lib/module-logging.html > > http://www.onlamp.com/pub/a/python/2005/06/02/logging.html > > http://antonym.org/node/76 > > BTW: 就算没有logging, 也可以用unit test啊 :) 我在看这几个网页。如果有问题再来请教,谢谢。 -- ssSslang
Zeuux © 2025
京ICP备05028076号