mirror of https://gitlab.com/akasroua/covot
16 lines
391 B
Python
16 lines
391 B
Python
from csv import DictReader
|
|
|
|
|
|
def find_user(reader, id):
|
|
for row in reader:
|
|
if row["numero_de_documento"] == id or row["correo_institucional"] == id:
|
|
return row
|
|
raise Exception("Error: User not found")
|
|
|
|
|
|
def search_csv(filepath, id):
|
|
with open(filepath) as csvfile:
|
|
reader = DictReader(csvfile)
|
|
user = find_user(reader, id)
|
|
return user
|