My input is a list, say l
It can either contain 4 or 5 elements. I want to assign it to 5 variables , say a, b, c, d and e.
If the list has only 4 elements then the third variable (c) should be None.
If python had an increment (++) operator I could do something like this.
l = [4 or 5 string inputs]
i = -1
a = l[i++]
b = l[i++]
c = None
if len(l) > 4:
c = l[i++]
d = l[i++]
e = l[i++]
I can't seem to find an elegant way to do this apart from writing i+=1 before each assignment. Is there a simpler pythonic way to do this?