有没有办法在Python中使用断点?
我只是想知道是否有一种方法可以在 IDLE 中添加断点,以便我可以在脚本中的某个点停止并在空闲 shell 中编写其他行进行测试。如果不行的话还有其他软件可以实现这个功能吗?
I am just wondering if there is a way to add breakpoints in IDLE so that I can stop at a point in my script and write other lines in the idle shell for testing. If not, is there other software that can do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
添加该行
您可以在代码中的任何位置 ,到达后它会将您带入调试 shell。非常有用,我有一个 emacs 快捷方式来添加代码片段。
您可能还想查看ipdb,并
使用
you can add the line
anywhere in your code, when reached it will drop you into a debug shell. so useful i have an emacs shortcut to add the snippet.
you may also want to look at ipdb, and use
instead
http://docs.python.org/library/pdb.html
http://docs.python.org/library/pdb.html
如果您运行的是 Windows,并且想要一个具有更多功能的开发环境,则可以查看 PyScripter比 IDLE 的功能。
If you are running Windows, you might look at PyScripter if you want a development environment with more features than IDLE.