Suppose I have a file named abc.txt which contains the following data
Nathan Johnson 23 M
Mary Kom 28 F
John Keyman 32 M
Edward Stella 35 M
How do i create the objects of the data(records) in the file ?
Code which i have done . I am not getting of jow to create objects of data in a file
class Records:
def __init__(self, firstname, lastname, age, gender):
self.fname = firstname
self.lname = lastname
self.age = age
self.gender = gender
def read(self):
f= open("abc.txt","r")
for lines in f:
print lines.split("\t")
What should i do further ? I am an newbie in python and this task has been given to me. PLease help me out ?