Alle Dateien aus dem Pythonkurs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
493 B

2 years ago
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])