title: Python stop for loop until certain string exists in a continously changing log file
body: <p>I'm wondering if it is possible to do the following thing that is mentioned in the title in python. I managed to write a code to check if the file exists, but i'm stuck at the step, where I want to read the continously changing log file, until a certain string is found in it. The aim is to continue my for loop once that certain string is found in the log file:</p>
  
  <p>Here is the code i managed to write:</p>
  
  <pre><code>list1=[20,40,60]
  for i in list1:
      ##some code here
      while not os.path.exists("path.log"):
          time.sleep(1)
  
      if os.path.isfile("path.log"):
          while True:
               # with open ("path.log") as f:
                  if 'string' in open("path.log").read()
                      break
                  else 
                      time.sleep(1)
                      continue
      else:
          raise ValueError("%s isn't a file!" % file_path)
  </code></pre>