[python-win32] Get Blank Lines in a text file
siddhartha veedaluru
siddhartha.veedaluru at gmail.com
Fri Jul 4 07:01:29 CEST 2008
Hi,
As part of a task i need to verify that last line of a text file is blank.
When i read that file, its getting ignored and i couldn't able to check
that.
Here is the code snippet that i used:
import os
iniFileName = "Config.ini"
iniFile = open(iniFileName, 'r')
lines = iniFile.readlines()
noOfLines = len(lines)
if lines[noOfLines] == "":
print "Last line is blank"
else:
print "Last line is not blank"
regards,
Siddhartha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20080704/0547e0bd/attachment.htm>
More information about the python-win32
mailing list