我最近接受了朋友的挑战,但是我需要导入一个.dll来完成。为此,我编写了以下代码:
from tkinter import *
from tkinter.filedialog import askopenfilename
import ctypes
dll = ctypes.WinDLL(askopenfilename(filetypes=("All files", "*.*")))
然而,这似乎产生错误,我还没有真正打开一个文件对话框。请有人帮我修复我的代码或解释为什么这是错误的。你知道吗
编辑:
错误是:
Traceback (most recent call last):
File "C:/Users/jakeb/Desktop/New folder/jakes exploit.py", line 6, in <module>
exploitapi = ctypes.WinDLL(askopenfilename(filetypes=("All files", "*.*")))
File "C:\Users\jakeb\AppData\Local\Programs\Python\Python35-32\lib\tkinter\filedialog.py", line 375, in askopenfilename
return Open(**options).show()
File "C:\Users\jakeb\AppData\Local\Programs\Python\Python35-32\lib\tkinter\commondialog.py", line 48, in show
s = w.tk.call(self.command, *w._options(self.options))
_tkinter.TclError: bad file type "*.*", should be "typeName {extension ?extensions ...?} ?{macType ?macTypes ...?}?"
>>>
p.s.麦克的回答没有用
更改此项:
对此:
文件类型需要作为类型列表提供。所以只要加上方括号。你知道吗
相关问题 更多 >
编程相关推荐