title: Remove the slides contains specific strings (words in list) by pptx
body: <p>I would like to remove the slide indexes which contains specific words or strings.
  as of now I am able to remove based on slide index passed as list but I want to remove slides based on particular words in slides <strong>foreg if a slide contains these words [area of expertise, company, Name..], I want to remove those slides.</strong>
  I am using this code: refering (<a href="https://stackoverflow.com/questions/37375687/python-to-remove-copy-ppt-slides">Python to remove/copy .PPT slides</a>)</p>
  <pre><code>def dropSlides(slidesToKeep, prs):
      indexesToRemove = [x for x in range(1, len(prs.slides._sldIdLst)+1) 
      if x not in slidesToKeep]
  
      for i, slide in enumerate(prs.slides):
          id_dict = {slide.id: [i, slide.rId] for i, slide in enumerate(prs.slides._sldIdLst)}
  
          if i+1 in indexesToRemove:
              slide_id = slide.slide_id
  
              prs.part.drop_rel(id_dict[slide_id][1])
              del prs.slides._sldIdLst[id_dict[slide_id][0]]
  
      return prs
  file_name=&quot;abc.pptx&quot;
  prs = Presentation(Path(Path.cwd(), &quot;docs&quot;, file_name))
  newPrs = dropSlides([29,30,31,32....], prs)
  
  newPrs.save('Slides_kept.pptx')```
  </code></pre>