open multiple filenames in tkinter and add the filesnames to a list

后端 未结 4 836
别跟我提以往
别跟我提以往 2020-12-28 08:16

what I want to do is to select multiple files using the tkinter filedialog and then add those items to a list. After that I want to use the list to process each file one by

4条回答
  •  孤城傲影
    2020-12-28 08:34

    In Python 3, the way it worked for me was this (respect lowercase):

    from tkinter.filedialog import askopenfilenames
    
    filenames = askopenfilenames(title = "Open 'xls' or 'xlsx' file") 
    
    for filename in filenames:
        # print or do whatever you want
    

    I hope you find it useful! Regards!

提交回复
热议问题