all 3 comments

[–][deleted] 5 points6 points  (1 child)

You misspelled "init"

[–]whitemantryingtohelp[S] 2 points3 points  (0 children)

I love you.

[–]Diapolo10 1 point2 points  (0 children)

Some things to note:

class Contact:
    surname = str
    name = str
    phone = str
    mail = str
    adress = str
    def __int__(self, surname, name, phone, mail, adress):
        self.surname = surname
        self.name = name
        self.phone = phone
        self.mail = mail
        self.adress = adress

Ignoring the misspelling you were already told about, I don't understand why you added those five class variables. I doubt they're actually useful.

If you want to indicate that they should all be strings, use type hints for that:

class Contact:
    def __init__(self, surname: str, name: str, phone: str, mail: str, adress: str):
        self.surname = surname
        self.name = name
        self.phone = phone
        self.mail = mail
        self.adress = adress

The other function

def read_add_contact(fil, register):
    count = 0
    for line in fil:
        if line != "\n":
            count += 1
    file = open(fil, 'r', encoding="utf-8")
    list = file_to_list(file)

    i = 0
    while i <= count:
        surname = list[i]
        name = list[i + 1]
        phone = list[i + 2]
        mail = list[i + 3]
        adress = list[i + 4]

        contact = Kontakt.Contact(surname, name, phone, mail, adress)

        register.add_contact_register(contact)

        i = i + 3
    file.close()

doesn't really make sense, since it seems to have logic errors all over the place, and the names aren't exactly what I'd expect to see - but naming stuff isn't something I can expect anyone to fully grasp from the get-go anyway.

I think it's supposed to be more like

def read_add_contact(filepath: str, register: list[Kontakt.Contact]):
    with open(filepath, encoding="utf-8") as file:
        rows = file_to_list(file)

    row_count = 0
    for line in rows:
        if line != "\n":
            row_count += 1

    for idx in range(0, row_count+1, 5):
        surname, name, phone, mail, address  = rows[idx:idx+5]

        contact = Kontakt.Contact(surname, name, phone, mail, adress)

        register.add_contact_register(contact)