mercredi 1 juillet 2020

Loop til every element returns true

I have a list with ids (list). Every element of that list returns a string 'true' or 'false' as a result of an online check with wget. I want to loop over that list, as long as there is a element returning a 'false' value. Basically I want to repeat this:

for i in range(len(list)):
  wget online check
  if status == 'true':
    write id to another list
  elif status == 'false':
    continue
  time.sleep()

over and over again until everything is true.

I tried it with a nested while loop:

for j in range(len(list)):
    while status_ == 'false':
        wget online check
      if status == 'true':
        write id to another list
      elif status == 'false':
        continue
      time.sleep()

But that doesn't work. Can anyone help please?

Cheers

Aucun commentaire:

Enregistrer un commentaire