I am doing a lexical analyzer for a class and one of the things that it must accomplish is to count the line breaks. How can I count the line breaks in Python from a text file? This is my code, am I using regular expressions?
**def newLine(linea):
count = 0
if re.match("\s",linea):
count += 1
#print("Salto de linea {0}".format(count))
else:
pass
print ("Salto de linea totales en el archivo: {0}".format(count))