def __init__(self, items): self._format = "".join([item[0] for item in items]) self._items = items self._buffer_ = win32wnet.NCBBuffer(struct.calcsize(self._format)) for format, name in self._items: if len(format)==1: if format == 'c': val = '\0' else: val = 0 else: l = int(format[:-1]) val = '\0' * l self.__dict__[name] = val
def __init__(self, items): self._format = string.join(map(lambda item: item[0], items), "") self._items = items self._buffer_ = win32wnet.NCBBuffer(struct.calcsize(self._format)) for format, name in self._items: if len(format) == 1: if format == 'c': val = '\0' else: val = 0 else: l = int(format[:-1]) val = '\0' * l self.__dict__[name] = val