python:询问用户要打开的文件:tkinter.filedialog.askopenfilename
询问用户要打开的文件
# a program to show the file's name user selected by the method 'askopenfilename'.
from tkinter.filedialog import askopenfilename
import os
file = askopenfilename()
filename = os.path.basename(file)
print('The name of the file you just selected is:'+ filename)
文件选择
运行结果
# The name of the file you just selected is:kv_first_time_takeover
moyutime:本文仅是学习心得,观点仅供参考,祝愿读者学习途中快乐且不断有所收获。