此代码:
用户只是选择一个文件夹,但是文件名必须始终相同才能正常工作。我怎样才能要求文件?
from tkinter import filedialog
import pandas as pd
folder = filedialog.askdirectory(title="Select main folder: ")
#folder = path.Path(fname)
x = pd.read_csv(folder + '\\20180911_Dataset_b.csv', sep = ',', encoding = "utf-8")
答案 0 :(得分:1)
要询问文件而不是文件夹,请使用:
line