|
Your code removes empty lines (which IMO is a bad thing, as it makes the result less readable) but does not adjust the number of lines accordingly. A file I tested ended at line 103 (although there were actually 118 lines in the file, including blank lines); your code went on to print 118 line numbers.
|