file
This commit is contained in:
20
python/3/3Fic1.py
Normal file
20
python/3/3Fic1.py
Normal file
@@ -0,0 +1,20 @@
|
||||
f = open ("books.csv", "r")
|
||||
max = 0
|
||||
f.readline()
|
||||
for row in f:
|
||||
ligne = row.split(",")
|
||||
if int(ligne[0]) > max:
|
||||
max = int(ligne[0])
|
||||
|
||||
print("la valeur max est ", max)
|
||||
f.close()
|
||||
|
||||
f = open("books.csv", "a")
|
||||
titre = input("Un titre: ")
|
||||
auteur = input("Un auteur: ")
|
||||
annee = input("Une année: ")
|
||||
enregistrement = str(max+1) + ", " + titre + ", " + auteur + ", " + annee + "\n"
|
||||
f.write(enregistrement)
|
||||
f.close()
|
||||
|
||||
|
Reference in New Issue
Block a user