python结构文件使用python函数作为它的编号,它是如何工作的?

2024-04-19 06:01:30 发布

您现在位置:Python中文网/ 问答频道 /正文

如何使其工作如下:

from ctypes import *
from ctypes.wintypes import *


def func(s):
    return s


class aa(structure):
    pass


aa._fields_ = [('a', c_char), ('b', func)]
a = aa()
a.a = '1'
a.b = func('2')

Tags: fromimportfieldsreturndefpassctypesstructure