My problem is the following: I have a text with 100 lines, each line contains the family- name, the given-name and one room in the form "family-name, Given-name room" the room contained by 3 elements "building,floor,office" like "A.15.10" so a complete line will be
"name, name A.15.10"
I want to make a class Room with attributes building, floor,office and store room like "A.15.10". The a class with attributes familyname, givenname, room. I want to load all the information from this file to an array of familyname, givenname, room and print it out. What i did until now without classes.
file=open('file.txt','r')
data=file.readlines()
k=len(data)
c=list(range(k))
for i in range(k):
c=data.split()
for i in range(k):
d=c[i][2].split('.')
now the element c[i][0] is the family-name c[i][1] the given-name and c[i][3] the room. After i split again the element c[i][3] to have the building the floor and the room. How can i have all these by classes. Sorry if i didn't explain the problem well.
withstatement for opening files in Python.