mardi 26 janvier 2016

How do I count the number of blank lines in a text file?

Some options that I have tried are below.

if line.strip() == "":

or

if line == "":

or

if line == "\n":

None of these really worked because they either counted all lines, non-blank lines or didn't count any.

Aucun commentaire:

Enregistrer un commentaire