unpack tuple of wrong size

Tung Wai Yip tungwaiyip at yahoo.com
Tue Apr 6 13:50:14 EDT 2004


I want to do 

t = (1,2)
a,b = t  # get a=1 and b=2

However when
t = (1,)
a,b=t

I got a "ValueError: unpack tuple of wrong size"

What I want is for a=1 and b=None. Is there a good way to do this?


Wai Yip Tung



More information about the Python-list mailing list