Guest User

Untitled

a guest
Jan 22nd, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. data = {
  2. "name": "deep",
  3. "age": 21,
  4. "roll_no": 114
  5. }
  6. class Student:
  7. def __init__(self,name,age,roll_no):
  8. self.name = name
  9. self.age = age
  10. self.roll_no = roll_no
  11. @classmethod
  12. def from_dicts(cls, data):
  13. students = []
  14. for row in data:
  15. student = cls(row['name'], row['age'], row['roll_no'])
  16. students.append(student)
  17. return students
Add Comment
Please, Sign In to add comment