def trova(stringa,sottostr): pos = 0 array = [] while pos < len(stringa): fix = stringa.find(sottostr,pos) if fix == -1: return array # print "fix" + str(fix) array.append(fix) # print "array" + str(array) pos = fix+1 # print 'posizione' + str(pos) return array h = raw_input("Inserisci str ") k = raw_input("Inserisci sub ") print trova(h,k)