Last active
August 29, 2015 14:04
-
-
Save yask123/007842da6b3d141bace8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Student(list): | |
def __init__(self,a_name,a_age,a_branch,a_pointers): | |
list.__init__([]) | |
self.name=a_name | |
self.age=a_age | |
self.branch=a_branch | |
self.append(a_pointers) | |
def top_pointer(self): | |
return(sorted(self)[0]) | |
get_data(filename): | |
with open(filename) as f: | |
data = f.readline() | |
temp=data.strip().split(',') | |
return(Student(temp.pop(0),temp.pop(0),temp)) | |
store_data(): | |
"""This method returns the dictionary of instances mapped by student's name """ | |
maps={} | |
temp1=get_data('test.txt') | |
maps[temp1.name]=temp1#Cool eh? | |
return(maps) | |
for each_student in store_data():#Kid's stuff! | |
print(store_data()[each_student]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment