Use GUI to open directory in Python 3

前端 未结 1 1492
悲&欢浪女
悲&欢浪女 2021-01-23 08:13

I just want to find the string value of the directory in python where a few files are located, then I plan on using os.listdir to continue on with the script. I\'ve tried using

相关标签:
1条回答
  • 2021-01-23 08:49

    tkFileDialog changed with Python 3.x, it's now tkinter.filedialog, a module of tkinter

    Here's how to import it:

    from tkinter.filedialog import askdirectory
    
    folder = askdirectory()
    

    Refer to: http://docs.python.org/3.0/library/tkinter.html#tkinter-modules

    0 讨论(0)
提交回复
热议问题