如何调试python代码? [英] How to debug python code?

查看:78
本文介绍了如何调试python代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是Python编程的新手。我没有得到正确的pdb.Can

有人告诉我调试python代码的有效方法吗?

请给我任何一个例子。

寻找回应。

谢谢。

Sushant


I am new to Python programming.I am not getting exactly pdb.Can
anyone tell me effective way to debug python code?
Please give me any example.
Looking for responce.
Thank You.
Sushant

推荐答案

这是一篇写得很好的文章,附带例子来自

Stephen Ferg:

http://www.ferg.org/papers/debugging_in_python.html


Ravi

Here is an outstandingly well written article, with examples, from
Stephen Ferg:

http://www.ferg.org/papers/debugging_in_python.html

Ravi


su ************** @ gmail.com 写道:

我是Python编程新手。我没有得到正确的pdb.Can
有谁告诉我调试python代码的有效方法?

I am new to Python programming.I am not getting exactly pdb.Can
anyone tell me effective way to debug python code?




(自动)单元测试+打印语句+交互式shell是

通常就足够了。我几乎从未在5年多的Python编程中使用过pdb。


-

bruno desthuilliers

python -c" print''@''。join([''。''。join([w [:: - 1] for p in p.split(''。'')])

p在''o **** @ xiludom.gro''。split(''@'')])"



(automated) unit tests + print statements + the interactive shell are
usually enough. I almost never used pdb in 5+ years of Python programming.

--
bruno desthuilliers
python -c "print ''@''.join([''.''.join([w[::-1] for w in p.split(''.'')]) for
p in ''o****@xiludom.gro''.split(''@'')])"


1.。)打印语句
2.)IDE


大多数Python IDE提供可视化调试器,因此您不必使用

命令行,例如pdb。

与所有允许作为脚本执行的语言一样,

打印语句通常可以在大多数情况下完成工作。


请阅读Python常见问题解答(就像你应该学习的任何新语言一样)。
http://www.python.org/doc/faq/

它回答了您在另一个帖子中发布的IDE问题

很多你未来的问题很好。

1.) Print statements
2.) IDEs

Most Python IDEs provide visual debuggers so that you don''t have to use
command line ones such as pdb.

As with all languages that allow to be executated as a script as well,
print statements usually get the job done quite well in most cases.

Please read the Python FAQ (as you should for any new language you
learn) in its entirety.
http://www.python.org/doc/faq/
It answers your IDE question you posted in the other thread as well as
many of your future questions quite well.


这篇关于如何调试python代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆