alist = [1,3,5,2,0,3,7,0,0,3,7]for i in range(len(alist)): if alist[i] == 0: alist[i] = 1print alist
for index, value in enumerate(alist): if value==0: alist[index]=1