Answers for "python count new lines"

0

count a newline in string python

length = x.count('n')
Posted by: Guest on May-31-2020
0

python count lines in string

txt = 'line1nline2nline3n'  # Three newline characters
print(txt.count('n'))         # prints: 3
Posted by: Guest on February-01-2022

Python Answers by Framework

Browse Popular Code Answers by Language