default value in a list
lbates at syscononline.com
Sat Jan 22 00:41:07 CET 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