title: Is there a way to write bits of text to different files if different conditions are met?
body: <p>I have this text which i will share a part from,</p>
  
  <blockquote>
    <p>ROMEO</p>
    
    <p><em>But, soft! what light through yonder window breaks?
    It is the east, and Juliet is the sun.</em></p>
    
    <p>JULIET</p>
    
    <p><em>Ay me!</em></p>
    
    <p>ROMEO</p>
    
    <p><em>She speaks:
    O, speak again, bright angel! for thou art.</em></p>
    
    <p>JULIET</p>
    
    <p><em>O Romeo, Romeo! wherefore art thou Romeo?
    Deny thy father and refuse thy name;</em></p>
    
    <p>ROMEO</p>
    
    <p><em>Shall I hear more, or shall I speak at this?.</em></p>
  </blockquote>
  
  <p>I want to write a loop that looks for the name in the line and saves the contents after it to a specific file, in this case if "ROMEO" is the word found every line after it will be saved to "Romeo.txt" until the word "JULIET" is found then all content is saved to "Juliet.txt". I tried coding it myself with an amalgamation of loops and if statements but it got me to nowhere. 
  handle = open("romeo-full.txt")
  skipper = "ROMEO"</p>
  
  <pre><code>handle = open("romeo-full.txt")
  skipper = "ROMEO"
  
  for line in handle:
      line = line.strip()     
      while skipper == "ROMEO":
          print(line) #This would be the write to file code
          if line.startswith("ROMEO"):
              skipper = "JULIET"
              break
          else:
              continue
  
      while skipper == "JULIET":
          print(line) #This would be the write to file code
          if line.startswith("ROMEO"):
              skipper = "ROMEO"
              break
          else:
              continue
  </code></pre>
  
  <p>The output is basically "ROMEO" lines looping, which i understood it's coming from the while loop going through the first line forever, but i couldn't figure a way out closer to what i want than this.</p>