The issue I am having is that the while loop goes through every line fine and does examine the semi colon correctly, but always reports that there is a problem with the last line of the file, because it is whitespace...
I have tried stripping lines, and getting the file loop to run only when the line has characters in it... but this seems to disable the while loop from working at all.
See code Below.
Expand|Select|Wrap|Line Numbers
- # takes in each individual line of the file
- line = fileIN.readline()
- # counter
- x = 1
- # while loop
- while line:
- # != None:
- # != re.sub("\n\s*\n*", "\n", line):
- line = fileIN.readline()
- line.strip()
- # checks that each line has a semi colon after each identifier
- if line[2:3] != ";":
- print "\nThere is a problem with the identifier on line", x + 1
- print line
Pete