Re: Checking if a text file is blank

2008-04-20 Thread Andrew Lee
David wrote: >> import os >> print os.lstat("friends.txt")[6] >> > > I prefer os.lstat("friends.txt").st_size MUCH easier to remember Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Checking if a text file is blank

2008-04-20 Thread evenrik
On Apr 20, 2:04 pm, [EMAIL PROTECTED] wrote: > Greetings! > > 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("frie

Re: Checking if a text file is blank

2008-04-20 Thread prashanth
Hi [EMAIL PROTECTED] wrote: > Greetings! > > Is there any way in python to check if a text file is blank? obviously there are many ways, one simple way is to check length if its None then the file is blank. > > What I've tried to do so far is: > > f = file("friends.txt", "

Re: Checking if a text file is blank

2008-04-20 Thread David
> > import os > print os.lstat("friends.txt")[6] > I prefer os.lstat("friends.txt").st_size -- http://mail.python.org/mailman/listinfo/python-list

Re: Checking if a text file is blank

2008-04-19 Thread Andrew Lee
[EMAIL PROTECTED] wrote: > Greetings! > > 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") >

Re: Checking if a text file is blank

2008-04-19 Thread Dan Bishop
On Apr 20, 1:04 am, [EMAIL PROTECTED] wrote: > Greetings! > > 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("frie

Re: Checking if a text file is blank

2008-04-19 Thread David
> > 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 f.read() is True: > """do stuff""" > else: > """do other stuf

Checking if a text file is blank

2008-04-19 Thread elnoire
Greetings! 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 f.read() is True: