how get how amny line is string in python code example Example: count a newline in string python length = x.count('\n')