How can I find out the size of a file

Discussion in 'Python' started by Marko.Cain.23@gmail.com, Mar 28, 2007.

  1. Guest

    Hi,

    How can I find out the size of a file in a disk in python?

    i try this, but it does not work:
    size = open(inputFileNameDir + "/" + file, 'r').size()

    Thank for any help.
     
    , Mar 28, 2007
    #1
    1. Advertisements

  2. wrote:
    > How can I find out the size of a file in a disk in python?


    os.path.getsize(filename)


    -Irmen
     
    Irmen de Jong, Mar 28, 2007
    #2
    1. Advertisements

  3. momobear Guest

    On Mar 29, 6:09 am, wrote:
    > Hi,
    >
    > How can I find out the size of a file in a disk in python?
    >
    > i try this, but it does not work:
    > size = open(inputFileNameDir + "/" + file, 'r').size()
    >
    > Thank for any help.


    os.stat(filename),
    see stat manual for detail.(st_size )
     
    momobear, Mar 29, 2007
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ad
    Replies:
    2
    Views:
    1,094
  2. tiewknvc9
    Replies:
    6
    Views:
    919
    Chris Uppal
    Oct 1, 2006
  3. Abandoned
    Replies:
    2
    Views:
    359
    Adonis Vargas
    Dec 2, 2007
  4. Jason Cavett

    Preferred Size, Minimum Size, Size

    Jason Cavett, May 23, 2008, in forum: Java
    Replies:
    5
    Views:
    13,472
    Michael Jung
    May 25, 2008
  5. Keith Thompson

    Re: File Size - Big File Size

    Keith Thompson, Oct 1, 2009, in forum: C Programming
    Replies:
    6
    Views:
    510
    Phil Carmody
    Oct 3, 2009
  6. Michael Tsang

    Re: File Size - Big File Size

    Michael Tsang, Oct 4, 2009, in forum: C Programming
    Replies:
    2
    Views:
    513
    Keith Thompson
    Oct 4, 2009
  7. Nobody

    Re: File Size - Big File Size

    Nobody, Oct 5, 2009, in forum: C Programming
    Replies:
    10
    Views:
    2,432
    Flash Gordon
    Oct 10, 2009
  8. mark
    Replies:
    34
    Views:
    3,634
    David Thompson
    Nov 21, 2011
Loading...