I need to perform some CRUD operations in Python.
I have used below details. I have captured some users details and added them in a list now, where I'm printing that list I am only getting last inserted row.
from pprint import pprint
class Institute:
studentID = int();
studentName=str();
trinerName=str();
my_list = []
my_obj = Institute()
my_obj.studentID = 100;
my_obj.studentName = "Student 1";
my_obj.trinerName = "Trainer 1";
my_list.append(my_obj)
my_obj.studentID = 101;
my_obj.studentName = "Student 2";
my_obj.trinerName = "Trainer 2";
my_list.append(my_obj)
newobj = vars(my_obj);
print(newobj);
This gives me
{'studentID': 101, 'studentName': 'Student 2', 'trinerName': 'Trainer 2'}
But I want to display all added objects.