解決方案
回答最多的就是使用python內(nèi)部集成的tkinter圖形庫
Python3
import tkinter as tk
from tkinter import filedialog
root = tk.Tk()
root.withdraw()
file_path = filedialog.askopenfilename()
Python2
import Tkinter, tkFileDialog
root = Tkinter.Tk()
root.withdraw()
file_path = tkFileDialog.askopenfilename()
常見的文件選擇對(duì)話框函數(shù)有
打開一個(gè)文件:askopenfilename()
打開一組文件:askopenfilenames()
保存文件:asksaveasfilename()
選擇文件夾:askdirectory()