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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM