Skip to content
Snippets Groups Projects
Forked from Vuillemot Romain / INF-TC1
103 commits behind the upstream repository.
test_file.py 500 B
from File import *

if __name__=="__main__": 

    data = []

    with open("etudiants.txt") as f:
        keys = None
        for line in f:
            l = [w.strip() for w in line.split(';')]
            if keys is None:
                keys = l
            else:
                data.append({k:v for k, v in zip(keys, l)})
                
    file = File()

    for d in data:
        file.ajoute(d)

    e = file.renvoie(lambda x : x['filiere'] == "PC")

    print(e['nom'] + " " + e['prenom'])