How to get a list of files in a folder on a site?

Viewed 31

I have a site with a folder containing images, I need to get links to all these images, that is, how to go through the files in the directory. How can I do this? It is desirable to use the urllib module, but not in principle

1 Answers

you can use tkinter file library

from tkinter import*
from tkinter import filedialog
root = Tk()
root.title('Hi')

root.filename = filedialog.askopenfilename(initialdir="/programming/Python/", title="Select a file", filetypes = ("all files","*.*"))
my_label = Label(root, text=root.filename.pack()
                 


root.mainloop()

Please note that this exact code will most likely not work on your system so you neeed to tinker with it you can look up how to displaay a file using tkinter

Related