from csv import * from math import hypot def distance(L1,L2): return hypot(L1[0]-L2[0],L1[1]-L2[1]) point_mystère = (320,240) table = [] with open('prairie.csv','r') as fichier: lignes = reader(fichier,delimiter=' ') for ligne in lignes: (x,y) = (int(ligne[0]),int(ligne[1])) couleur = ligne[2] table.append((distance(point_mystère,(x,y)),couleur)) def neighbours(couple): return couple[0] table.sort(key=neighbours) print([table[k][1] for k in range(3)])