In <[EMAIL PROTECTED]>, Michiel Sikma wrote: > My code: > > ---- test.py ---- > import sys > > def preparse(file): > block = [] > for line in file: > if line.strip(): > block.append(line) > elif block: > yield ''.join(block).strip() > block = [] + yield ''.join(block).strip()
Because your line "test10\n" is still in `block` at this point. > yield '\n' > > […] > > ---- test ---- > test1 > test2 > > test3 > test4 > test5 > test6 > > test7 > test8 > > test9 > > test10 > ---- > > When I run test.py, it prints this: > michiel-sikmas-computer:~/Desktop msikma$ python test.py > ['test1\ntest2', 'test3\ntest4\ntest5\ntest6', 'test7\ntest8', > 'test9', '\n'] > > What happened to "test10"? It seems to be gone unless I add two > linebreaks at the end of the file. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list