Not sure below is better but it hacks at larger chunks (excuse the 10
second coding)
m = [2,9,1,5,6,3,1,1,9,2]
f = 1
temp = m
location = m.index(f)
gloc = location
temp = m[location:]
while 1:
   print(temp)
   try:
      location = temp.index(f) + 1
      gloc += location
   except:
      break
   temp = temp[location:]
#Remove the last 0th element
gloc -= 1
print("Last location = %d" % gloc)

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to