【发布时间】:2015-07-10 03:36:59
【问题描述】:
以下代码中的“%ds”是什么意思?
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)
【问题讨论】:
-
我知道“%s”或“%d”的意思,但我不明白“%ds”的用法
-
它是一个以数字开头的字符串。例如:2a,3b
标签: python-2.7