converting list to multiple parameters

Alex cut_me_out at hotmail.com
Wed Sep 13 18:20:05 EDT 2000


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