Линии подсчета питонов в строке
txt = 'line1\nline2\nline3\n' # Three newline characters
print(txt.count('\n')) # prints: 3
Yaakov Belch
txt = 'line1\nline2\nline3\n' # Three newline characters
print(txt.count('\n')) # prints: 3