36 lines
886 B
Python
36 lines
886 B
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
|
||
|
# Polarité;Action;Fait;Valeur;Ordre
|
||
|
f = open("fr-esr-referentiel_de_transformation_numerique_esr.csv","r")
|
||
|
|
||
|
lignes = f.readlines()
|
||
|
|
||
|
chiffres = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
||
|
|
||
|
### Recherche de l'indice de la colonne 'Ordre'
|
||
|
entete = lignes[0].split(';')
|
||
|
print (entete)
|
||
|
# entete = ['Polarité', 'Action', 'Fait', 'Valeur', 'Ordre']
|
||
|
indice = 0
|
||
|
while (entete[indice] != 'Ordre') and (entete[indice] != 'Ordre\n'):
|
||
|
indice = indice + 1
|
||
|
print("indice : ", indice)
|
||
|
|
||
|
ordre_min_actuel = 1000000
|
||
|
num_ligne = 0
|
||
|
i = 0
|
||
|
for ligne in lignes:
|
||
|
l = ligne.split(';')
|
||
|
# l[indice][0] c'est le premier caractère
|
||
|
# l[indice] == '89'== ['8', '9']
|
||
|
if l[indice][0] in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']:
|
||
|
|
||
|
if int(l[indice]) < ordre_min_actuel:
|
||
|
|
||
|
ordre_min_actuel = int(l[indice])
|
||
|
num_ligne = i
|
||
|
i = i + 1
|
||
|
|
||
|
|
||
|
print(lignes[num_ligne])
|