【发布时间】:2021-09-14 06:06:01
【问题描述】:
我有 UUID 列表 (block_list) 并想检查一个特定的 UUID 是否列在该列表中。
list(block_list)
Out[41]:
[ ('f779e98c-a541-4ae2-afcb-b0da2e5bee24',),
('a005bc7b-c06d-48bf-8259-757d52c70330',),
('8af278b1-089e-40e9-a57d-856efe336c26',)]
为什么说我是假的?
块列表中的“8af278b1-089e-40e9-a57d-856efe336c26” 答案:错误
谢谢 罗伯特
【问题讨论】:
-
因为列表中没有 UUID,所以列表中的元组中有 UUID:即使检索单个数据,SQL 查询也总是返回元组。
-
('8af278b1-089e-40e9-a57d-856efe336c26',) in [ ('f779e98c-a541-4ae2-afcb-b0da2e5bee24',), ('a005bc7b-c06d-48bf-8259-757d52c70330',), ('8af278b1-089e-40e9-a57d-856efe336c26',)]
标签: python postgresql