title: Python - Insert data into a word document using a list
body: <p>I have a word document with data and I have 2 lists with phrases. I would like to loop through the word document and wherever a specific keyword is found (so keyword_one and keyword_two in this instance), add a new line and insert the first item from the relevant list.</p>
  <p>My code below is only adding one item from one list to keyword_one and I think it could be to do with the for loop structure - please could someone point me in the right direction?</p>
  <p>Code:</p>
  <pre><code>document = Document('mydocx.docx')
  my_list=['Some key points here', 'We expected values to be higher. That is fine', 'final attributes', 'local dataset'] 
  my_second_list=['My random data', 'Flowers. That is fine', 'happy birthday', 'puppies']
  
  for para in document.paragraphs:
      print(para.text)
      for i in my_list:
          for j in my_second_list:
              if 'Keyword_one' in para.text: 
                  para.add_run('         ' +i)
              if 'Keyword_two' in para.text:
                  para.add_run('      ' + j)
          else:
              break
              
  document.save(&quot;mydocx.docx&quot;)
  
  </code></pre>
  <p>Desired example output:</p>
  <pre><code>My ms word document.
  
  Keyword_one
  Some key points here. I have some additional data
  Other data here
  
  Keyword_two 
  Flowers
  
  Heading 1
  
  Keyword_one
  We expected values to be higherThat is fine'
  
  Keyword_one 
  final attributes
  
  Keyword_two 
  My random data. Other random data here
  
  Heading 1
  
  Keyword_two 
  Flowers
  
  </code></pre>