converting list to multiple parameters

Oliver Rutherfurd oliver at rutherfurd.net
Wed Sep 13 21:28:42 EDT 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