bool value of a list in Python

后端 未结 4 512
名媛妹妹
名媛妹妹 2021-01-18 05:45

what is the best way to turn a list into bool value? I am looking for something like:

return eval_bool(my_list)

I have a custom container i

4条回答
  •  执笔经年
    2021-01-18 06:39

    Just use:

    bool(my_list)
    

    Which evaluates it as Python "truthiness" and returns a real Boolean.

提交回复
热议问题