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
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
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", "
>
> import os
> print os.lstat("friends.txt")[6]
>
I prefer os.lstat("friends.txt").st_size
--
http://mail.python.org/mailman/listinfo/python-list
[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")
>
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
>
> 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
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: