Recently I wrote a program as follows:
empty_list = []
for row in rows:
    if row.num1 != 0:
        empty_list.extend(row.amt1)
    if row.num2 != 0:
         empty_list.extend(row.amt2)
    if row.num3 != 0:
         empty_list.extend(row.amt3)
    if row.num4 != 0:
         empty_list.extend(row.amt4)
this pattern goes on till num10.
Basically we are extending the list till we find row.num{d} = 0.
My question is since the variables are numbered, can we do something in a pythonic way or in a loop. The example is simplified. We are importing legacy data from an old dbase format.
 
     
     
     
    