如何在if语句中使用多个“not in”?

用户_6396

是否可以not inif语句中使用多个

for each_id in lst:
    if "Audiobook" not in (driver.find_element_by_id('productDetailsTable').text) & "a-popover-root" not in (driver.page_source):
        titles.append(driver.find_element_by_id('title').text)

上面的代码对我不起作用,我尝试了多种但无法弄清楚,

任何帮助表示赞赏?

iz_

您需要使用逻辑“与”( and),而不是按位的“与”( &):

if "Audiobook" not in (driver.find_element_by_id('productDetailsTable').text) and "a-popover-root" not in (driver.page_source):

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章