title: highlight text using python-docx
body: <p>I want to highlight text in docx and save it another file.
  here is my code </p>
  
  <pre><code>from docx import Document
  
  def highlight_text(filename):
  
      doc = Document(filename)
      for p in doc.paragraphs:
          if 'vehicle' in p.text:
              inline = p.runs
              # print(inline)
              # Loop added to work with runs (strings with same style)
              for i in range(len(inline)):
                  # print((inline[i].text).encode('ascii'))
                  if 'vehicle' in inline[i].text:
                      x=inline[i].text.split('vehicle')
                      inline[i].clear()
                      for j in range(len(x)-1):
                          inline[i].add_text(x[j])
                          y=inline[i].add_text('vehicle')
                          y.highlight_color='YELLOW'
              # print (p.text)
  
      doc.save('t2.docx')
      return 1
  if __name__ == '__main__':
  
      highlight_text('t1.docx')
  </code></pre>
  
  <p>word is not getting highlighted what i am doing wrong.</p>