How do I kill an empty file ??

chris.nelson at bwc.state.oh.us chris.nelson at bwc.state.oh.us
Tue Jan 23 10:59:38 EST 2001


Hello:
I have several TAB files that are generated daily for reports that are
then converted into graphs. The problem is that every now and then a
report file will fail to generate data and I will have an empty file.

Currently I read in the the file assigning it to a variable and
readlines()
Then I use the following to parse out blank lines in a normal file


        for line in data:
	    j=0
	    if len(line)>2:
            ......rest of code

What's an easy way to adapt this so that I can ignore files that are
nothing but empty lines? Ultimately I'm looking for sytax that will
ignore processing a file if it is empty.

Please advise and tanks,
Chris


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list