try:
    countlines = countchars = 0
    file = open('mój_plik1.txt', 'r')
    lines = file.readlines()
    for line in lines:
        countlines += 1
        for char in line:
            countchars += 1
    file.close()
    print("Liczba znaków:", countchars)
    print("Liczba wierszy:", countlines)
except IOError as error:
    print("Błąd wejścia/wyjścia:", str(error))
