嘿,我正在尝试在Python 2.7中运行脚本,并且已经下载了匹配的Python for Windows扩展包。出于某种原因,我仍然收到此错误。有谁知道我可以在哪里下载win32netcon?NameError:未定义全局名称'win32netcon'
win32wnet.WNetAddConnection2(win32netcon.RESOURCETYPE_DISK,
NameError: global name 'win32netcon' is not defined
嘿,我正在尝试在Python 2.7中运行脚本,并且已经下载了匹配的Python for Windows扩展包。出于某种原因,我仍然收到此错误。有谁知道我可以在哪里下载win32netcon?NameError:未定义全局名称'win32netcon'
win32wnet.WNetAddConnection2(win32netcon.RESOURCETYPE_DISK,
NameError: global name 'win32netcon' is not defined
您需要先导入win32netcon。
import win32wnet, win32netcon
win32wnet.WNetAddConnection2(win32netcon.RESOURCETYPE_DISK, password, username, flags)
仅有代码的答案经常被忽视。试着看看你是否可以用一些文字陪同你的答案中的代码。 –
好的,我会的,谢谢 – Safoyeth
如果您在代码中使用名称,则需要导入它。 –