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
| # Lecture du fichier csv
import csv
with open('D://CyberSecurite/Cyber/Exercice.csv', newline='') as csvfile:
reader = csv.reader(csvfile, delimiter=',')
for row in reader:
print(' - '.join(row),'\n')
# Lecture de la colonne Info
import csv
with open('D://CyberSecurite/Cyber/Exercice.csv') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
print("Colonne Info :", row['Info'],'\n')
# Rechercher le mot passwd et afficher la ligne correspondante
import csv
mot = "passwd" # le mot à chercher...
with open('D://CyberSecurite/Cyber/Exercice.csv', newline='') as csvfile:
for i in csvfile:
if mot in i:
print( "Mot_localisé >>> ", ' '.join(i)) |