school = [] class Lehrer(): def __init__(self, vorname, name): self.vorname = vorname self.name = name def __str__(self): return f'{self.vorname} {self.name}' try: with open('namen.csv','r') as f: for line in f: splitted = line.strip().split(',') name = splitted[0] vorname = splitted[1] lehrer = Lehrer(vorname,name) school.append(lehrer) except IOError as x: print(f'I/O-Fehler: {x}') print(school) print(school[0]) print(school[3])