[Tutor] Invoking a procedure with an uknown number of arguments...

Kent Johnson kent37 at tds.net
Fri Mar 23 16:19:51 CET 2007


Lars Erik Gullerud wrote:
> Hello list,
> 
> I have the following problem; I have a list with an unknown number of 
> strings, like so:
> 
>    MyList = ['string1', 'string2', 'string3'..'stringN']
> 
> Now, I need to call a procedure from a 3rd party module (which is just a 
> wrapper around a C library), where each of these strings must be passed 
> as a separate argument, i.e.
> 
>    MyProc(arg1, arg2, arg3..argN)
> 
> So, the question is basically, how can I invoke this procedure and pass 
> each of these list elements as separate arguments, when I don't know in 
> advance how many elements there will be?

MyProc(*MyList)

More details here:
http://mail.python.org/pipermail/tutor/2007-March/053435.html

Kent


More information about the Tutor mailing list