My large input file is a filename.txt which has many blank lines throughout it. When I find a blank line, I want to ignore it, but when I find an EOF, I want to halt the program. I have read that there is no such thing in Python, but there must be a clever workaround.
len = 0 occurs at blank lines so can't be used to identify end of file neither can '' and for the same reason I need my loop to stop when there are no more rows to read.
I have read the other "answers", but I can't "assume" len(0) means eof or the loop won't stop
Actually playing around with variations: len blank line reports 1 / same answer with 1 char line len stripped line - 0 all len lines is true number of chars +1 (counting CRLF?) all len of stripped line is true number of chars
I want to strip my incoming at some point in the program anyway, so now I do it right after the read and the logic works. If len of stripped line = 0, I know that is a blank line and can process accordingly.
My question is answered, I'm good to go.