converting list to multiple parameters

Oliver Rutherfurd oliver at rutherfurd.net
Thu Sep 14 03:28:42 CEST 2000


Hi Alex,

That's it exactly!  Thanks for the quick reply.

-Ollie
oliver at rutherfurd.net

"Alex" <cut_me_out at hotmail.com> wrote in message
news:etdem2oj5nu.fsf at x15-cruise-basselope.mit.edu...
>
> Ollie:
> > I'd like to pass an list of values to struct.pack(), but it tells me
that
> > the parameters need to be strings.  It there a way I can convert the
list to
> > a bunch of parameters?
>
> Yeah, use apply.  Something like
>
> x = apply(struct.pack, ('3s3s3s',) + tuple(theList))
>
> Alex.
>
> --
> Speak softly but carry a big carrot.
>





More information about the Python-list mailing list