this requires filename to be a path or buffer object where as on the very line above filename is indeed a StringVar object:filename = tk.StringVar()df = pd.read_csv(filename, encoding='latin-1')为了达到 StringVar 或任何Variable子类类型的值,需要使用 get 方法.In order to reach the value of StringVar or any of the Variable subclass types, one needs to use get method.filename.get()但是,这将导致一个空字符串'',这将引发另一个错误.However, that would result an empty string, '' which would raise another error. 这篇关于ValueError:无效的文件路径或缓冲区对象类型:< class'tkinter.StringVar'>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-14 18:40