1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| # -*- coding: utf-8 -*-
import csv
fichier_cible1 = open("contact.txt", "a")
sortie_w1 = csv.writer(fichier_cible1)
fichier_cible2 = open("contact.csv", "a")
sortie_w2 = csv.writer(fichier_cible2)
test = [
['Nom', 'Tel', 'email', 'date'],
['Bob', '0606060607', 'bob@contact.fr', '02/05/1997'],
]
for element in test:
print(element)
sortie_w1.writerow(element)
sortie_w2.writerow(element)
nouveau = ['Julie','06000000','juju','32/02/2028']
sortie_w1.writerow(nouveau)
sortie_w2.writerow(nouveau)
fichier_cible1.close()
fichier_cible2.close() |