csv
This commit is contained in:
36
python/5/esr.py
Executable file
36
python/5/esr.py
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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])
|
Reference in New Issue
Block a user