Sep-29-2018, 05:32 AM
Am learning to create a python API. I want to get a return a student object whenever there's a match of student name when I loop through the students data.
Please tell me what I am doing wrong. I get the error TypeError: string indices must be integers
Please tell me what I am doing wrong. I get the error TypeError: string indices must be integers
class Student(Resource): #get student by name def get(self, name): for student in students: if name == student["name"]: return student, 200 return "student not found", 404