jeudi 22 juillet 2021

For Loop not looping through all the data

I'm trying to loop through some text I got from a website but the if statements in the loop are not skipping what I don't need and other text that I need is not being looped through and printed.

for i in range(14):
  posting = driver.find_elements_by_xpath('//div[contains(@class,"slider_container")][1]')

for value in posting:
 values= (value.text)

#cleaning text
number= range(31)
text=[]

for i in values.split():

  if i == 'new':
   continue
  if i == 'Today·More...':
   continue
  if i == 'Easily apply':
   continue
  if i == 'Just posted·More...':
   continue
  if i == 'Just posted':
   continue
  if i == 'Responsive employer':
   continue

  for m in number:
   date = str(m) + 'days ago·More...'
   if i == date:
     continue

  for m in number:
   date = str(m) + 'days ago'
   if i == date:
     continue

  text.append(i)
  print (text)

Aucun commentaire:

Enregistrer un commentaire