What does "%ds" in following codes mean?
theline = 'aaaaaeeebbbbbbbbccccccccddd'
baseformat = "5s 3x 8s 8s"
numremain = len(theline) - struct.calcsize(baseformat)
format = "%s %ds" % (baseformat, numremain)
s1, s2, s3, s4= struct.unpack(format, theline)
The '%ds' is not a format specifier. It's '%d' followed by 's':
>>> "%ds" % 6
6s
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With