1

I'm building a simple app, where it converts pdf to png.

When I use:

pdf_name = askopenfilenames(initialdir="/", title="Selecionar Arquivos")

I get:

print(pdf_name)

('C:/Users/user/Desktop/Apps/Python/Conversor img to pdf/file.pdf',)

So, the ask is:

How do I get this type?

print(pdf_name)

'C:/Users/user/Desktop/Apps/Python/Conversor img to pdf/file.pdf'

1 Answers1

2

There are two ways to do that.

First

pdf_name = askopenfilenames(initialdir="/", title="Selecionar Arquivos")
print(pdf_name[0])

Second, Instead of askopenfilenames, you should try askopenfilename.

Also, Not Forget To Import this from tkinter.filedialog import askopenfilename.

pdf_name = askopenfilename(initialdir="/", title="Selecionar Arquivos")
print(pdf_name)

The output is same for both

'C:/Users/user/Desktop/Apps/Python/Conversor img to pdf/file.pdf'
codester_09
  • 5,622
  • 2
  • 5
  • 27