#!/usr/bin/python # simple repro case for debugging struct.unpack() issues with 'p' (pascal strings) import struct raw = struct.pack('=8s4s10p5p', 'Spammity','Spam','Wonderful','Spam') print 'len(raw:', repr(raw) val = struct.unpack_from('=8s4spp',raw,0) print val