Python Count Lines en la cadena
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