determining the number of output arguments

Darren Dale dd55 at cornell.edu
Sun Nov 14 17:12:24 EST 2004


Hello,

def test(data):

	i = ? This is the line I have trouble with

	if i==1: return data 
	else: return data[:i]

a,b,c,d = test([1,2,3,4])

How can I set i based on the number of output arguments defined in 
(a,b,c,d)?

Thank you,
Darren



More information about the Python-list mailing list