"michael" <mhyoung at valdosta.edu> wrote in message news:mailman.987034096.12363.python-list at python.org... [snip] > if (buf[0] == EXCLUDE): This assumes 0 is in-range as an index: it will not be if buf is an EMPTY (0-length) string. > learning purposes. This program works fine until it gets to the last > line in the testfile and I get this error. Right, because after the last line an empty string is returned. > Can someone please tell me what I'm doing wrong? I've looked all over > the net and in several books for a solution. For example, just change this previously-quoted test to if buf.startswith(EXCLUDE): THIS will work even when buf is the 0-length string. Alex
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4