[Python] How to choose saving directory with python-pptx?

Discussão em 'Python' iniciado por Stack, Setembro 1, 2025.

  1. Stack

    Stack Membro Participativo

    I'm pretty new to python and I've been working on a project with pptx python. Everything is fine, but I don't understand how to choose in which directory my file will be saved.

    Here is my code:

    from pptx import Presentation
    prs = Presentation()
    title_slide_layout = prs.slide_layouts[0]
    slide = prs.slides.add_slide(title_slide_layout)
    title = slide.shapes.title
    subtitle = slide.placeholders[1]

    title.text = "Hello, World!"
    subtitle.text = "python-pptx was here!"

    prs.save('test.pptx')


    It will save the document on my desktop. How can I choose the directory ?

    Thanks in advance! PS : I'm using python 3.7

    Continue reading...

Compartilhe esta Página