调试时如何调用Python的列表? [英] How do I call the Python's list while debugging?

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

问题描述

我有以下python代码:

I have the following python code:

values = set([1, 2, 3, 4, 5])
import pdb
pdb.set_trace()

我运行脚本在调试外壳中:

I run the script and I am in the debugging shell:

(pdb) list(values)
*** Error in argument: '(values)'
(Pdb)

如何调用列表(值)而不调用调试器自己的 list 命令?

How can I call list(values) in the debugger without invoking the debugger's own list command?

推荐答案

只需 print 它:

(Pdb) print list(values)

不要在python3版本中添加括号

don't foget to add brackets for python3 version

(Pdb) print(list(values))

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

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