default value in a list
lbates at syscononline.com
Fri Jan 21 18:41:07 EST 2005
What do you want put into the "missing" variables?
I'll assume None. Something like following
except IndexError: a=None
except IndexError: b=None
except IndexError: c=None
> Is there an elegant way to assign to a list from a list of unknown
> size? For example, how could you do something like:
>>>> a, b, c = (line.split(':'))
> if line could have less than three fields?
More information about the Python-list