CLOCHARD Léandre
3 years ago
1 changed files with 21 additions and 10 deletions
@ -1,10 +1,21 @@ |
|||||
import csv |
def lecture(name): |
||||
|
"""lit le fichier csv dont le nom est passé en paramètre, en renvoie trois tableau contenant |
||||
def lecture(fichier_csv): |
respectivement la longueur et la largeur des pétales, et l'espèce de l'iris.""" |
||||
"renvoie un tabeau" |
lst_date = [] |
||||
with open(fichier_csv, newline='') as csvfile: |
lst_pic = [] |
||||
spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|') |
lst_temp_moy = [] |
||||
for row in spamreader: |
lst_temp_ref = [] |
||||
print(', '.join(row)) |
with open(name) as fic: |
||||
|
fic.readline() |
||||
lecture("jeuTests.csv") |
for ligne in fic: |
||||
|
date, pic, temp_moy, temp_ref = ligne.split(';') |
||||
|
lst_date.append(date) |
||||
|
lst_pic.append(float(pic)) |
||||
|
lst_temp_moy.append(float(temp_moy)) |
||||
|
lst_temp_ref.append(float(temp_ref)) |
||||
|
|
||||
|
|
||||
|
return lst_date, lst_pic, lst_temp_moy, lst_temp_ref |
||||
|
|
||||
|
print(lecture("jeuTests.csv")) |
||||
|
|
Loading…
Reference in new issue