i found the solution thank you guys for showing intrest, accully the function where() do the iteration it self (that i did’nt know) there is no need to put it in an other loop, only the loop over “ngrains will do the trick.
data=loadtxt('data.csv',delimiter=",")
data1=data.transpose()
ngrains=loadtxt('nombre_grain.csv',delimiter=",")
phi0ex=len(ngrains)*[zeros(shape(250))]
for k in range(len(ngrains)):
print ngrains[k]
phi0ex[k]=where(data1==ngrains[k],1,0)
print phi0ex