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

时间:2019-02-13 06:29:39

标签: python python-3.x

是否可以在not in语句中使用多个if

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)

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

有什么帮助吗?

2 个答案:

答案 0 :(得分:2)

您需要使用逻辑“与”(protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "btnDelete") { int index = (Convert.ToInt32(e.CommandArgument)) % GridView1.PageSize; //Get row number GridViewRow row = GridView1.Rows[index]; } } ),而不是按位“与”(and):

&

答案 1 :(得分:0)

使用逻辑和,即代替&