gpt4 book ai didi

Python 3 list(dictionary.keys()) 引发错误。我究竟做错了什么?

转载 作者:太空狗 更新时间:2023-10-29 19:31:00 26 4
gpt4 key购买 nike

字典:

error['extras'] = {'expiration_month': 'Invalid field [expiration_month] - Missing field "expiration_month"'}

代码:

list(error['extras'].keys())

结果:

*** Error in argument: "(error['extras'].keys())"

如果相关,我将在一个被 pdb.set_trace() 暂停的 django 进程中运行这段代码。

最佳答案

我认为问题在于 list is a pdb debugger command .文档说明如下:

Commands that the debugger doesn’t recognize are assumed to be Python statements and are executed in the context of the program being debugged. Python statements can also be prefixed with an exclamation point (!).

所以你可以尝试像这样为 list 添加前缀:

!list(error['extras'].keys())

关于Python 3 list(dictionary.keys()) 引发错误。我究竟做错了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23050172/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com