Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为了对其进行一些操作,但我想从界面中进行操作以选择文件,而不是仅仅运行带有文件名的脚本,因为文件名每天都会改变。
您可以使用 Tkinter askopenfilename:
askopenfilename
from tkFileDialog import askopenfilename path = askopenfilename() f = open(path, 'r') # OR DO WHAT YOU WANT WITH PATH