Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to make == value as a list in python

i doin work for scraping data that equal to date.. i need scape data that equal to date in a list….

i try this code but didt works.. but if i use with only single data listdate = 'Jun 30, 2022' works…

listdate = ['Jun 23, 2022', 'Jun 24, 2022', 'Jun 25, 2022']

lp = driver.find_element(By.CSS_SELECTOR, 'div > time')
lpval = lp.get_attribute('title') ==  (listdate)
print(lpval)

if lpval == True :
        print('Do sometin')
else:
        print('Stop')

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Not sure if I understood correctly, but incase you want to check against all values in list, you can do lp.get_attribute('title') in listdate, which will return True if any of the values in the list match lp.get_attribute('title')

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading