问题 I'm writing a userspace driver for accessing FPGA registers in Python 3.5 that mmap s the FPGA's PCI address space, obtains a memoryview to provide direct access to the memory-mapped register space, and then uses struct.pack_into("<I", ...) to write a 32-bit value into the selected 32-bit aligned address. def write_u32(address, data): assert address % 4 == 0, "Address must be 32-bit aligned" path = path.lib.Path("/dev/uio0") file_size = path.stat().st_size with path.open(mode='w+b') as f: mv