好的,这不是我的代码,这是来自GitHub的代码,此行存在语法错误
unique_items = np.unique(df_clean[item_columns].values).tolist()
items_headers = ['item-' + s for s in unique_items if not in consumables]
我认为这是一个简单的错误,但我在python中很漂亮(消耗品在顶部定义)
答案 0 :(得分:4)
您需要在for i in range(1,3):
#iterate pages and get url
ureq = "https://somewebsite.com/#page=" + str(i)
driver.get(ureq.strip())
#create
soup = []
#main code here
try:
#Wait for page to load
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH,"some element in the DOM")))
src = driver.page_source
#Parse page with bs
soup = bs(src, "lxml")
except TimeoutException:
print("Timed out")
driver.quit()
#main code
driver.quit()
子句中检查consumables
中的成员身份的特定变量或表达式。
可能你想要:if