0
from pptx import Presentation  
prs = Presentation()  
prs.save('test2.pptx')

So I am using the above code to save a blank ppt in some location. Now if I want to save multiple ppts with names test1.ppt, test2.ppt, test3.ppt and so on, is there a way to loop it using a for-loop. Note that I am trying create multiple power-point presentations and not multiple slides in a single presentation. Really wish, the owner of pptx (@Scanny) can look into this.

FabioSpaghetti
  • 790
  • 1
  • 9
  • 35

1 Answers1

1

I think this is pretty straightforward:

from pptx import Presentation
prs = Presentation()
for i in Range(1, 4):
    prs.save('test{}.pptx'.format(i))
BigBen
  • 46,229
  • 7
  • 24
  • 40
  • 1
    Just to elaborate on this @MHarshit, the `Presentation.save()` method writes to the file named in its single argument each time it is called. So you can easily save as many copies of a given presentation as you like by simply providing distinct file paths/names to successive `.save()` calls. – scanny Aug 07 '19 at 03:23