2007/4/26, Stevie Broadfoot <[EMAIL PROTECTED]>:
> 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)
>
> but that doesnt work because it takes the list as an argument.
>
> How can I get around this problem?

I see two simple ways, maybe there are more:

1. simply use
printout(list[0],list[1])

2. Change the definition of printout to:

def printout(firstword, secondword = None):
    if secondword is None:
        (firstword,secondword) = firstword
    print firstword
    print secondword


--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644  --  Skype: a_engels
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to