[Tutor] Feeding a list into a function as arguments

Stevie Broadfoot coollikestevie at gmail.com
Thu Apr 26 16:03:57 CEST 2007


actually scrap that, it works perfectly :) thank you very much for your
help. One last question, does this only work on lists? or will tuples work
too and what else?

On 4/27/07, Stevie Broadfoot <coollikestevie at gmail.com> wrote:
>
> This is the best answer i've gotten so far... but its still not working...
>
> what exactly does the star do?
>
> the other solutions people provided do not suit my needs, my printout
> function was just an example, what i need it for is more complicated.
> I actually just need to feed the members of the list into the function...
> and this is to be applied to different functions with different numbers of
> arguments needed.
>
> On 4/26/07, Andreas Kostyrka <andreas at kostyrka.org> wrote:
> >
> > * Stevie Broadfoot <coollikestevie at gmail.com> [070426 09:56]:
> > >    I have a list... say for example
> > >
> > >    list = ["hello", "there"]
> > >
> > >    and i have a function
> > >
> > >    def printout(firstword, secondword):
> > >        print firstword
> > >        print secondword
> > >
> > >    and i want to call
> > >
> > >    the function like this
> > >
> > >    printout(list)
> > printout(*list)
> >
> > Andreas
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070427/30c88f61/attachment.html 


More information about the Tutor mailing list