getting file size

Bob Smith bob_smith_17280 at hotmail.com
Sat Jan 22 02:49:35 CET 2005


Are these the same:

1. f_size = os.path.getsize(file_name)

2. fp1 = file(file_name, 'r')
    data = fp1.readlines()
    last_byte = fp1.tell()

I always get the same value when doing 1. or 2. Is there a reason I 
should do both? When reading to the end of a file, won't tell() be just 
as accurate as os.path.getsize()?

Thanks guys,

Bob



More information about the Python-list mailing list