On Wed, Jan 30, 2008, David Bear wrote:
>I want to return a tuple from a function. I want to append the second
>element of that tupple to a list. For example
>
>mylist = []
>def somefunc():
>   return(3.14, 'some string')
>
>somenum, mylist.append(??) somefunc()
>
>obviously, the syntax doesn't work. This should be easy, but I've never seen
>example code. any pointers?

mylist.append(somefunc()[1])

Bill
--
INTERNET:   [EMAIL PROTECTED]  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

If ye love wealth greater than liberty, the tranquillity of servitude
greater than the animating contest for freedom, go home from us in peace.
We seek not your consul, nor your arms.  Crouch down and lick the hand that
feeds you.  May your chains set lightly upon you;  and may posterity forget
ye were our countrymen. -- Samuel Adams (American Patriot)
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to