jeudi 19 mars 2015

getting index of values retrieved from random.sample(list,2)..?

I have a file which contains a number of lists...I want to access the index of the values retrieved from each of these lists...i use the random function as shown below..It retrieves the values perfectly well..but I need to get the index of the values obtained..



for i in range(M):
print(krr[i])
print(krr[i].index(random.sample(krr[i],2)))
nrr[i]=random.sample(krr[i],2)

outf13.write(str(nrr[i]))
outf13.write("\n")


I got value error saying the two values retrieved are not in the list even though they exist...


advance thanx !...pls help





Aucun commentaire:

Enregistrer un commentaire