小编XJ2*_*220的帖子

Python - 如果在字典中的值那么

这是我的代码

    if "value" not in dictionary():
        do something
    else:
        do something else
Run Code Online (Sandbox Code Playgroud)

我收到错误'TypeError:'dict'对象不可调用.

我已经尝试将第一行更改为

    if dictionary["value"]:
Run Code Online (Sandbox Code Playgroud)

但得到一个不同的错误.我在哪里错了?

python dictionary if-statement

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

dictionary ×1

if-statement ×1

python ×1