from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('--students', required=True, help='A file containing student information')
parser.add_argument('--display', nargs='+')
arguments = parser.parse_args()
students = list()
with open(arguments.students) as student_file:
for line in student_file:
line = line.strip()
parts = line.split(",")
student = dict()
student["id"] = int(parts[0])
student["first"] = parts[1]
student["last"] = parts[2]
student["email"] = parts[3]
students.append (student)
if arguments.display:
students_to_display = arguments.display
else:
students_to_display = list()
id=int(input('Enter the id of the desired student: '))
students_to_display.append(id)
for id in students_to_display:
for student in students:
if student['id'] == int(id):
print ("{} {} ({})".format(student['first'], student['last'], student['email']))
break