Advertisement
Totoro3x

Untitled

Oct 20th, 2022 (edited)
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. class Nauczyciel:
  2.     nauczyciele = []
  3.     def __init__(self, imie):
  4.         self.imie = imie
  5.         self.klasy = []
  6.  
  7.  
  8. with open('.txt/szkola.txt', 'r') as plik:
  9.     wiersz = plik.readline().strip()
  10.  
  11.     while True:
  12.         if wiersz == "nauczyciel":
  13.             instancja = Nauczyciel(plik.readline().strip())
  14.             Nauczyciel.nauczyciele.append(instancja)
  15.             wiersz = plik.readline().strip()
  16.             while len(wiersz) == 2:
  17.                 instancja.klasy.append(wiersz)
  18.                 wiersz = plik.readline().strip()
  19.         else:
  20.             break
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement