I saw this question but it didn't help me much with my problem.
I have a list of strings, where the 12 first items are 20 bytes long (40 characters) and the 13'th is 19 bytes (38 characters), and this goes on for the rest of the list which is an arbitrary size (I am decoding an audio record which does not have a given size).
for packet in adpcm_packets[0:15]:
print packet
output:
0000000FFF77F7FFF2A1412F4B8058A891982070
F1885C08883C7A880018980B7A50E24AA8004E4C
5D38103F3C910810009941B91088F7D509008980
009980809F7C28008880B7B935A88A0208118C3B
C251881F4C00B1408088A1398007F1980259C800
A108892278E879B383F04B0B50188191F1888189
A9608080980808080E7E40080989080018A860D3
F4C800001C7A100810C90B8302118980FC508923
B888D782BD8283B802902902A7CB589008802080
90097F3A8A061C81880B7B40A9249A008E022E6D
20B22D923E9690A80121AB97E4A8800013D5E5B8
490992228F02A14AC00A419990971B2888009988
8A2698289A70C00B039A3A74D2098AE7B18828
3F1C5201D3F1A000811081190988808080808008
0808800880080808800080008881880919880A10
Now, I want a new list where each element contains 13 packets, i.e 12*40 + 1*38 = 518 characters (259 bytes).
blocks.append(adpcm_packets[0])
for packet in adpcm_packets[1:13]:
blocks[0] += packet
and then I am stuck for how to do this with the rest of the list. How can I achieve this?