Commit ea60e849 authored by JACOBS Thierry's avatar JACOBS Thierry
Browse files

ajout q4

parent e8a9d2d4
Rappel de la syntaxe de clic :
import click
@click.command()
@click.argument("nomArgument", default="def")
def taFonction(nomArgument):
if __name__ == "__main__":
question4()
\ No newline at end of file
Mise a part l'utilisation de click, le code est quasiment le même !
\ No newline at end of file
#!/usr/bin/env python3
import os
import click
import re
@click.command()
@click.argument("prenom", default="Titi")
def question4(prenom):
scor = 0
chemin = "../fichiers"
for dirpath, dirnames, filenames in os.walk(chemin):
for filename in filenames:
with open(dirpath + "/" + filename, 'r', encoding = "ISO-8859-1") as f:
for line in f:
a = re.search("e de .*\. R", line)
if a:
victime = a.group(0).split()[2][:-1]
if victime == prenom:
scor += 1
print(scor)
if __name__ == "__main__":
question4()
\ No newline at end of file
......@@ -17,8 +17,10 @@ def random_date(start, end):
random_second = randrange(int_delta)
return start + timedelta(seconds=random_second)
extensions = [".txt", ".py", ".cs", ".az", ".ez", ".lol", ".info", ".log", ".jpeg", ".png", ".doc", ".docx", ".odt", ".mp3", ".sic", ".oskour",
".aled", ".tutoras", ".FEFROI", ".bessbass", ".jesus", ".titi", ".tgd", ".croco", ".minous", ".CLIM", ".ASM"]
extensions = [ ".lol", ".log", ".sic", ".oskour",
".aled", ".tutoras", ".FEFROI", ".bessbass",
".jesus", ".titi", ".tgd", ".croco", ".minous",
".CLIM", ".ASM"]
bot_names = ["Amandine", "Estelle" , "Titi", "Hamza" ,"Clement" ,"Clement" ,"Michael" ,"Nicolas" ,"Hugo" ,"Elisa" ,"Chloe" ,"Sami" ,"Salim" ,"Alois" ,"Theo" ,"Killian" ,"Hadrien" ,"Quentin" ,"Martin" ,"Louen" ,"Christophe" ,"Maha" ,"Laura" ,"Flavien" ,"Arno" ,"Nada" ,"Soukayna" ,"Isabelle" ,"Simon" ,"Antonin","Arthur" ,"Solene" ,"Anthony" ,"Paul" ,"Adrien" ,"Lucas" ,"Theo" ,"Lucas" ,"Fabien" ,"Benjamin" ,"Coline" ,"Axelle" ,"Julia" ,"Victor" ,"Thomas" ,"Morgane" ,"Jean-Charles GILLES" ,"Tom" ,"Gauthier" ,"Emilien" ,"Benjamin" ,"Florian" ,"Alexis" ,"Guilhem" ,"Dylan" ,"Clement" ,"Yonah" ,"Lucile" ,"Rachel" ,"Amelie" ,"Tommy" ,"Mael" ,"Chloe" ,"Celia" ,"Baptiste" ,"Nizar" ,"Anthony" ,"Theo" ,"Paul" ,"Mohamed" ,"Honorin" ,"Leo" ,"Valentin" ,"Benjamin" ,"Helena" ,"Raphael" ,"Guilhem" ,"Victor" ,"Thibault" ,"Bechir" ,"Florian" ,"Quentin" ,"Heloise" ,"Paul" ,"Eliott" ,"Thomas" ,"Alexandre" ,"Leo" ,"Jeremy" ,"Ghali" ,"Mathis" ,"Gabriel" ,"Ryan" ,"Alex" ,"Giovan" ,"Thibaut" ,"Mehdi" ,"Cyrielle" ,"Hind" ,"Antoine" ,"Louis" ,"Wenhao" ,"Zhe" ,"Gisel" ,"Celine" ,"Laury" ,"KaWing" ,"Chaima" ,"Celine"]
bot_names = list(dict.fromkeys(bot_names))
......
Ouf, on sait qui a pris le plus chère dans cette histoire !
Mais maintenant, c'est l'heure de faire un relevé de notes !
Et pour ça, il nous faudrait un script qui peut être appelé depuis la console, et prend en paramètre un nom, pour nous dire le nombre de pénalités que cette personne a reçu !
Hop hop hop au boulot, c'est le dernier exo, après c'est fini !
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment