在 Windows 7(64 位)上的 ctypes 中使用 windll

Using windll in ctypes on Windows 7 (64bit)

想请问有没有人和我有类似的问题,有没有解决办法

当我在安装Windows 7(64位)之前使用Windows XP(32位)时,我在Python 2.7.8中使用了以下程序,没有任何错误:

from ctypes import *
kernel = windll.kernel32
...

当我 运行 在当前版本 OS 上运行此序列时,出现错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'windll' is not defined

有人能知道这个错误的根本原因在哪里以及如何解决这个问题吗?

mobaxterm 终端下注释中描述的短脚本(由jedwards 提议)为运行 时出现错误消息。当脚本在 cmd.exe 控制台中为 运行 时,没有出现错误。

谢谢大家提醒...