Simple file dialog

This is another way of using the Tk widgets. Here we have a plain command-line script, but instead of using the standard input() function of Python to ask for a filename it launches a Tk File-dialog widget to allow the user to browse and select a file.

from tkinter import filedialog

input_file_path = filedialog.askopenfilename(filetypes=(("Excel files", "*.xlsx"), ("CSV files", "*.csv"), ("Any file", "*")))

input("Press ENTER to end the script...")