title: Python Remove All Elements in List Before Specific Element
body: <p>I have a list that I am using to process a series of tasks on directories. Occasionally the process will get stuck at a certain directory. Currently I'm removing that element and re-running the process thru the list. However, this is getting to take a while.</p>
  
  <p>Here's what I'm doing now:</p>
  
  <pre><code>directories = next(os.walk('/home'))[1]
  directories.remove('brokendirectory')
  process_directory(directory)
  </code></pre>
  
  <p>What I'd like to do is to remove EVERY directory INCLUDING the directory that's broken and only work on the list of directories after that broken directory. Something like this:</p>
  
  <pre><code>def clear_list(directories, element):
    new_list = []
    for directory in directories:
      if directory == element:
          break
      else:
          new_list.append(directory)
    return(new_list)
  
  directories = next(os.walk('/home'))[1]
  new_directories = clear_list(directories,'brokendirectory')
  process_directory(new_directories)
  </code></pre>
  
  <p>Obviously my function does not work as-is. </p>
  
  <p>How can I remove all elements in the list including the one specified and return a new list for processing?</p>