Checking if a text file is blank

elnoire at elnoire at
Sun Apr 20 08:04:40 CEST 2008


I've just started learning python, so this is probably one of those
obvious questions newbies ask.

Is there any way in python to check if a text file is blank?

What I've tried to do so far is:

                f = file("friends.txt", "w")
		if is True:
			"""do stuff"""
			"""do other stuff"""

What I *mean* to do in the second line is to check if the text file is
not-blank. But apparently that's not the way to do it.

Could someone set me straight please?

More information about the Python-list mailing list