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. Advertising

  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. Advertising

  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. Advertising

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:
    890
  2. Shimon Sim

    How to find out size of Session?

    Shimon Sim, May 4, 2006, in forum: ASP .Net
    Replies:
    8
    Views:
    10,196
    Steven Cheng[MSFT]
    May 23, 2006
  3. Ian Tuomi

    How to find out the size of an array?

    Ian Tuomi, Oct 10, 2003, in forum: C Programming
    Replies:
    28
    Views:
    767
    Mark McIntyre
    Oct 14, 2003
  4. Abandoned
    Replies:
    2
    Views:
    283
    Adonis Vargas
    Dec 2, 2007
  5. Jason Cavett

    Preferred Size, Minimum Size, Size

    Jason Cavett, May 23, 2008, in forum: Java
    Replies:
    5
    Views:
    12,736
    Michael Jung
    May 25, 2008
Loading...

Share This Page