I am trying to print the slide number and store it in a list in python, from a power point presentation using some specific String. Suppose I have a string named "CR". If CR is present in a slide then it will print that slide number and also store it in a list. My code is given below, but unfortunately it prints all the slide index numbers.
from pptx import Presentation
word = 'CR'
ppt = Presentation('D:\\Users\\Shaon_Paul\\pptss\\abc.pptx')
for slide in ppt.slides:
slides = ppt.slides
if (word.find('CR') != -1):
print(ppt.slides.index(slide) + 1 )
else:
print ("Doesn't contains given string")
Using the code above it prints all the slide number in the ppt but I want to print only the slide numbers which have the string "CR" and store them in a list. Need help to resolve this issue.