Unpacking a list of strings

Alex Martelli aleaxit at yahoo.com
Thu Apr 27 11:11:04 EDT 2006


Panos Laganakos <panos.laganakos at gmail.com> wrote:

> Is there some other practice than reading all the strings and slicing
> them later?
> 
> They're stored in the form of:
> List Group[10]:
>     char[17] name;
> 
> So I thought of doing:
> unpacked = unpack('%s' % (10*17), data)
> 
> And then slicing the list by a step of 17.
> 
> Is there some way to have unpack return a tuple with each element
> holding the name (char[17])?

unpack by formatstring 10*'17s' ...


Alex



More information about the Python-list mailing list