以下代碼中的「%ds」是什麼意思?python「%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)
這可能會幫助你:http://stackoverflow.com/questions/4288973/s-and-d-python –
我知道「%s」或「%d」的含義,但我無法理解用法「%ds」 – Lancert9
它是一個以數字開頭的字符串。例如:2a,3b –