Hi I want to loop over links I am retrieving from an access database and then get each link a number of times my code is as follows the problem is it gets to the second link and stops
count=0
for link in df['Links']:
while count < 2:
driver = webdriver.Chrome(executable_path=path, options=options)
driver.get("" + link)
time.sleep(100)
driver.close()
count = count + 1
>Solution :
I think it makes more sense to use a for-loop in this case:
for link in df['Links']:
for _ in range(2):
driver = webdriver.Chrome(executable_path=path, options=options)
driver.get("" + link)
time.sleep(100)
driver.close()
_ is a variable, much like x or count would act, but conventionally it’s used when the variable is not used, such as this case.