Пример 1:
col = 0
col1 = 0
for x in open("file", "r").readlines():
if x == "":
col += 1
continue
if x != "#":
col1 += 1
print("Количество плохих строк:", col, ", количество комментариев:", col1)
Пример 2:
with open('file.txt', encoding='utf-8') as f:
nbad, nint = 0, 0
for line in f:
line = line.rstrip('\n')
if line in ('#', ''):
pass
elif all(c in '0123456789' for c in line):
nint += 1
else:
nbad += 1
print(nbad, nint)