That code would have worked fine in Python 2.x, but it is no longer valid. In Python 3.x, tkFileDialog
was renamed to filedialog
and placed inside the Tkinter package. Nowadays, you import it like so:
import tkinter.filedialog
# or
from tkinter import filedialog
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…