{"id":5983,"date":"2021-08-26T17:35:33","date_gmt":"2021-08-26T12:05:33","guid":{"rendered":"https:\/\/python-programs.com\/?p=5983"},"modified":"2021-11-22T18:39:30","modified_gmt":"2021-11-22T13:09:30","slug":"python-get-file-size-in-kb-mb-or-gb-human-readable-format","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/","title":{"rendered":"Python: Get file size in KB, MB, or GB \u2013 human-readable format"},"content":{"rendered":"

In this tutorial of getting the file size in KB, MB, or GB in Human-readable format in Python, we are going to see how we can get the sizes of different files in bytes, kilobytes, megabytes, gigabytes, etc.<\/p>\n

Different ways to get file size in Bytes, Kilobytes, Megabytes, Gigabytes, etc<\/h2>\n
    \n
  1. Get file size using os.path.getsize()<\/li>\n
  2. Get file size using os.stat().st_size<\/li>\n
  3. Get size using pathlib.Path.stat().st_size<\/li>\n
  4. Get file size in KiloBytes, MegaBytes, or GigaBytes<\/li>\n<\/ol>\n

    Method-1: Get file size in bytes using os.path.getsize()<\/h4>\n

    In this function, we pass the path of the file into it and if the file exists it returns the file size in bytes. If the file does not exist it throws os.error<\/code>.<\/p>\n

    Syntax:<\/em><\/p>\n

    Syntax : os.path.getsize(path)<\/pre>\n

    \"Program<\/p>\n

    Source Code:<\/em><\/p>\n

    # Program to Get\u00a0file\u00a0size\u00a0in\u00a0bytes\u00a0using\u00a0os.path.getsize()\r\n\r\nimport os\r\ndef fileSizeInBytes(filePath):\r\n    \"\"\"Size of the file in bytes\"\"\"\r\n    sizeOfFile = os.path.getsize(filePath)\r\n    return sizeOfFile\r\nfilePath = 'movie.mkv'\r\n#Getting the size of the file from by passing the path into the function\r\nsizeOfFile = fileSizeInBytes(filePath)\r\nprint('Size of the file(In Bytes) - ', sizeOfFile)\r\n<\/pre>\n
    Output :\r\nSize of the file(In Bytes) -\u00a0 349016027<\/pre>\n

    Method-2: Get file size in bytes using os.stat().st_size<\/h4>\n

    We can also find the size of the file using a stats( ) <\/em><\/strong>function available in Python\u2019s OS module. It takes the file path as an argument and returns an object containing the file details.<\/p>\n

    Syntax:<\/em><\/p>\n

    os.stat(path, *, dir_fd=None, follow_symlinks=True)<\/pre>\n

    \"Program<\/p>\n

    Source Code: <\/em><\/p>\n

    # Program to Get\u00a0file\u00a0size\u00a0in\u00a0bytes\u00a0using\u00a0os.stat().st_size\r\n\r\nimport os\r\ndef fileSizeInBytes(filePath):\r\n    \"\"\"Find the size of the file in bytes\"\"\"\r\n    statOfFile = os.stat(filePath)\r\n    #Size of file from the stats\r\n    sizeOfFile = statOfFile.st_size\r\n    return sizeOfFile\r\nfilePath = 'movie.mkv'\r\n#Getting the size of the file from by passing the path into the function\r\nsizeOfFile = fileSizeInBytes(filePath)\r\nprint('Size of the file(In Bytes) - ', sizeOfFile)\r\n<\/pre>\n
    Output :\r\nSize of the file(In Bytes) -\u00a0 349016027<\/pre>\n

    Method-3: Get file size in bytes using pathlib.Path.stat().st_size<\/h4>\n

     <\/p>\n

    # program to Get\u00a0file\u00a0size\u00a0in\u00a0bytes\u00a0using\u00a0pathlib.Path.stat().st_size\r\n\r\nfrom pathlib import Path\r\ndef fileSizeInBytes(filePath):\r\n    \"\"\"Size of the file in bytes\"\"\"\r\n    fileObj = Path(filePath)\r\n    #Size of file from the stats\r\n    sizeOfFile = fileObj.stat().st_size\r\n    return sizeOfFile\r\nfilePath = 'movie.mkv'\r\n#Getting the size of the file from by passing the path into the function\r\nsizeOfFile = fileSizeInBytes(filePath)\r\nprint('Size of the file(In Bytes) - ', sizeOfFile)\r\n<\/pre>\n
    Output :\r\nSize of the file(In Bytes) -\u00a0 349016027<\/pre>\n

    Method-4: Get file size in human-readable units like kilobytes (KB), Megabytes (MB), or GigaBytes (GB)<\/h4>\n

    We can get the file sizes using the above method but we can not convert them to KB, MB, GB, TB directly so we have to create a function. The function would convert the units and so us the size of the file in our desired unit.<\/p>\n

    Here is a conversion table to switch from bytes to another unit of measurement :<\/p>\n\n\n\n\n\n\n
    Units<\/strong><\/td>\nNumber of bytes<\/strong><\/td>\n<\/tr>\n
    KiloBytes<\/strong><\/td>\n1024<\/td>\n<\/tr>\n
    MegaBytes<\/strong><\/td>\n1024*1024 = 1\u00a0048\u00a0576\u202c<\/td>\n<\/tr>\n
    GigaBytes<\/strong><\/td>\n1024*1024*1024 = 1\u00a0073\u00a0741\u00a0824<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

    et file size in human-readable units like kilobytes (KB), Megabytes (MB), or GigaBytes (GB<\/p>\n

    #Program to Get file size in human-readable units like KB, MB, GB, TB\r\n\r\nimport enum\r\nimport os\r\n\r\nclass sizeUnit(enum.Enum):\r\n    #class to store the various units\r\n    BYTES = 1\r\n    KB = 2\r\n    MB = 3\r\n    GB = 4\r\n\r\ndef unitConvertor(sizeInBytes, unit):\r\n    #Cinverts the file unit\r\n    if unit == sizeUnit.KB:\r\n        return sizeInBytes\/1024\r\n    elif unit == sizeUnit.MB:\r\n        return sizeInBytes\/(1024*1024)\r\n    elif unit == sizeUnit.GB:\r\n        return sizeInBytes\/(1024*1024*1024)\r\n    else:\r\n        return sizeInBytes\r\n\r\ndef fileSize(filePath, size_type):\r\n    \"\"\"File size in KB, MB and GB\"\"\"\r\n    size = os.path.getsize(filePath)\r\n    return unitConvertor(size, size_type)\r\n\r\nfilePath = 'movie.mkv'\r\nsizeOfFile = fileSize(filePath,sizeUnit.BYTES)\r\nprint('Size of the file in - ', sizeOfFile)\r\n#Printing the size of file in KB\r\nsizeOfFile = fileSize(filePath,sizeUnit.KB)\r\nprint('Size of the file in KB - ', sizeOfFile)\r\n#Printing the size of file in MB\r\nsizeOfFile = fileSize(filePath,sizeUnit.MB)\r\nprint('Size of the file in MB - ', sizeOfFile)\r\n#Printing the size of file in GB\r\nsizeOfFile = fileSize(filePath,sizeUnit.GB)\r\nprint('Size of the file in GB - ', sizeOfFile)\r\n<\/pre>\n
    Output :\r\nSize of the file in -\u00a0 349016027\r\nSize of the file in KB -\u00a0 340835.9638671875\r\nSize of the file in MB -\u00a0 332.8476209640503\r\nSize of the file in GB -\u00a0 0.32504650484770536<\/pre>\n

    Check if the file exists before checking for the size of the file<\/h3>\n

    In case the file does not exist it will throw an error disrupting our program\u2019s execution. So to handle that we can check if the file exists or not and if not then handle it by using the if-else <\/em>block.<\/p>\n

    # Program to check\u00a0if\u00a0the\u00a0file\u00a0exists\u00a0before\u00a0checking\u00a0for\u00a0the\u00a0size\u00a0of\u00a0the\u00a0file\r\n\r\nimport os \r\n\r\ndef fileSizeInBytes(filePath):\r\n    \"\"\" Size of the file in bytes\"\"\"\r\n    sizeOfFile = os.path.getsize(filePath)\r\n    return sizeOfFile\r\n\r\n#Passing a file name that does not exist into the program\r\nfileName = 'nonExistentFile.txt'\r\nif os.path.exists(fileName):\r\n    size = fileSizeInBytes(fileName)\r\n    print('Size of file in Bytes : ', size)\r\nelse:\r\n    print('File not there')\r\n<\/pre>\n
    Output :\r\nFile not there<\/pre>\n","protected":false},"excerpt":{"rendered":"

    In this tutorial of getting the file size in KB, MB, or GB in Human-readable format in Python, we are going to see how we can get the sizes of different files in bytes, kilobytes, megabytes, gigabytes, etc. Different ways to get file size in Bytes, Kilobytes, Megabytes, Gigabytes, etc Get file size using os.path.getsize() …<\/p>\n

    Python: Get file size in KB, MB, or GB \u2013 human-readable format<\/span> Read More »<\/a><\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[5],"tags":[],"yoast_head":"\nPython: Get file size in KB, MB, or GB \u2013 human-readable format - Python Programs<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python: Get file size in KB, MB, or GB \u2013 human-readable format - Python Programs\" \/>\n<meta property=\"og:description\" content=\"In this tutorial of getting the file size in KB, MB, or GB in Human-readable format in Python, we are going to see how we can get the sizes of different files in bytes, kilobytes, megabytes, gigabytes, etc. Different ways to get file size in Bytes, Kilobytes, Megabytes, Gigabytes, etc Get file size using os.path.getsize() … Python: Get file size in KB, MB, or GB \u2013 human-readable format Read More »\" \/>\n<meta property=\"og:url\" content=\"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Programs\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/btechgeeks\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-26T12:05:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-11-22T13:09:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/python-programs.com\/wp-content\/uploads\/2021\/05\/Program-to-Get-file-size-in-bytes-using-os.path_.getsize.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@btech_geeks\" \/>\n<meta name=\"twitter:site\" content=\"@btech_geeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Satyabrata Jena\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/python-programs.com\/#organization\",\"name\":\"BTech Geeks\",\"url\":\"https:\/\/python-programs.com\/\",\"sameAs\":[\"https:\/\/www.instagram.com\/btechgeeks\/\",\"https:\/\/www.linkedin.com\/in\/btechgeeks\",\"https:\/\/in.pinterest.com\/btechgeek\/\",\"https:\/\/www.youtube.com\/channel\/UC9MlCqdJ3lKqz2p5114SDIg\",\"https:\/\/www.facebook.com\/btechgeeks\",\"https:\/\/twitter.com\/btech_geeks\"],\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/python-programs.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/python-programs.com\/wp-content\/uploads\/2020\/11\/BTechGeeks.png\",\"contentUrl\":\"https:\/\/python-programs.com\/wp-content\/uploads\/2020\/11\/BTechGeeks.png\",\"width\":350,\"height\":70,\"caption\":\"BTech Geeks\"},\"image\":{\"@id\":\"https:\/\/python-programs.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/python-programs.com\/#website\",\"url\":\"https:\/\/python-programs.com\/\",\"name\":\"Python Programs\",\"description\":\"Python Programs with Examples, How To Guides on Python\",\"publisher\":{\"@id\":\"https:\/\/python-programs.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/python-programs.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#primaryimage\",\"url\":\"https:\/\/python-programs.com\/wp-content\/uploads\/2021\/05\/Program-to-Get-file-size-in-bytes-using-os.path_.getsize.png\",\"contentUrl\":\"https:\/\/python-programs.com\/wp-content\/uploads\/2021\/05\/Program-to-Get-file-size-in-bytes-using-os.path_.getsize.png\",\"width\":757,\"height\":402,\"caption\":\"Program to Get file size in bytes using os.path.getsize()\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#webpage\",\"url\":\"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/\",\"name\":\"Python: Get file size in KB, MB, or GB \u2013 human-readable format - Python Programs\",\"isPartOf\":{\"@id\":\"https:\/\/python-programs.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#primaryimage\"},\"datePublished\":\"2021-08-26T12:05:33+00:00\",\"dateModified\":\"2021-11-22T13:09:30+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/python-programs.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python: Get file size in KB, MB, or GB \u2013 human-readable format\"}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#webpage\"},\"author\":{\"@id\":\"https:\/\/python-programs.com\/#\/schema\/person\/0f6d731bda7051ce3586f71299f391cd\"},\"headline\":\"Python: Get file size in KB, MB, or GB \u2013 human-readable format\",\"datePublished\":\"2021-08-26T12:05:33+00:00\",\"dateModified\":\"2021-11-22T13:09:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#webpage\"},\"wordCount\":350,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/python-programs.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/python-programs.com\/wp-content\/uploads\/2021\/05\/Program-to-Get-file-size-in-bytes-using-os.path_.getsize.png\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#respond\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/python-programs.com\/#\/schema\/person\/0f6d731bda7051ce3586f71299f391cd\",\"name\":\"Satyabrata Jena\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/python-programs.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c1bf8033ec357d085f41815bee1625cc?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c1bf8033ec357d085f41815bee1625cc?s=96&d=mm&r=g\",\"caption\":\"Satyabrata Jena\"},\"url\":\"https:\/\/python-programs.com\/author\/satyabrata\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python: Get file size in KB, MB, or GB \u2013 human-readable format - Python Programs","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/","og_locale":"en_US","og_type":"article","og_title":"Python: Get file size in KB, MB, or GB \u2013 human-readable format - Python Programs","og_description":"In this tutorial of getting the file size in KB, MB, or GB in Human-readable format in Python, we are going to see how we can get the sizes of different files in bytes, kilobytes, megabytes, gigabytes, etc. Different ways to get file size in Bytes, Kilobytes, Megabytes, Gigabytes, etc Get file size using os.path.getsize() … Python: Get file size in KB, MB, or GB \u2013 human-readable format Read More »","og_url":"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/","og_site_name":"Python Programs","article_publisher":"https:\/\/www.facebook.com\/btechgeeks","article_published_time":"2021-08-26T12:05:33+00:00","article_modified_time":"2021-11-22T13:09:30+00:00","og_image":[{"url":"https:\/\/python-programs.com\/wp-content\/uploads\/2021\/05\/Program-to-Get-file-size-in-bytes-using-os.path_.getsize.png"}],"twitter_card":"summary_large_image","twitter_creator":"@btech_geeks","twitter_site":"@btech_geeks","twitter_misc":{"Written by":"Satyabrata Jena","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","@id":"https:\/\/python-programs.com\/#organization","name":"BTech Geeks","url":"https:\/\/python-programs.com\/","sameAs":["https:\/\/www.instagram.com\/btechgeeks\/","https:\/\/www.linkedin.com\/in\/btechgeeks","https:\/\/in.pinterest.com\/btechgeek\/","https:\/\/www.youtube.com\/channel\/UC9MlCqdJ3lKqz2p5114SDIg","https:\/\/www.facebook.com\/btechgeeks","https:\/\/twitter.com\/btech_geeks"],"logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/python-programs.com\/#\/schema\/logo\/image\/","url":"https:\/\/python-programs.com\/wp-content\/uploads\/2020\/11\/BTechGeeks.png","contentUrl":"https:\/\/python-programs.com\/wp-content\/uploads\/2020\/11\/BTechGeeks.png","width":350,"height":70,"caption":"BTech Geeks"},"image":{"@id":"https:\/\/python-programs.com\/#\/schema\/logo\/image\/"}},{"@type":"WebSite","@id":"https:\/\/python-programs.com\/#website","url":"https:\/\/python-programs.com\/","name":"Python Programs","description":"Python Programs with Examples, How To Guides on Python","publisher":{"@id":"https:\/\/python-programs.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/python-programs.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#primaryimage","url":"https:\/\/python-programs.com\/wp-content\/uploads\/2021\/05\/Program-to-Get-file-size-in-bytes-using-os.path_.getsize.png","contentUrl":"https:\/\/python-programs.com\/wp-content\/uploads\/2021\/05\/Program-to-Get-file-size-in-bytes-using-os.path_.getsize.png","width":757,"height":402,"caption":"Program to Get file size in bytes using os.path.getsize()"},{"@type":"WebPage","@id":"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#webpage","url":"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/","name":"Python: Get file size in KB, MB, or GB \u2013 human-readable format - Python Programs","isPartOf":{"@id":"https:\/\/python-programs.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#primaryimage"},"datePublished":"2021-08-26T12:05:33+00:00","dateModified":"2021-11-22T13:09:30+00:00","breadcrumb":{"@id":"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/python-programs.com\/"},{"@type":"ListItem","position":2,"name":"Python: Get file size in KB, MB, or GB \u2013 human-readable format"}]},{"@type":"Article","@id":"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#article","isPartOf":{"@id":"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#webpage"},"author":{"@id":"https:\/\/python-programs.com\/#\/schema\/person\/0f6d731bda7051ce3586f71299f391cd"},"headline":"Python: Get file size in KB, MB, or GB \u2013 human-readable format","datePublished":"2021-08-26T12:05:33+00:00","dateModified":"2021-11-22T13:09:30+00:00","mainEntityOfPage":{"@id":"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#webpage"},"wordCount":350,"commentCount":0,"publisher":{"@id":"https:\/\/python-programs.com\/#organization"},"image":{"@id":"https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#primaryimage"},"thumbnailUrl":"https:\/\/python-programs.com\/wp-content\/uploads\/2021\/05\/Program-to-Get-file-size-in-bytes-using-os.path_.getsize.png","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/python-programs.com\/python-get-file-size-in-kb-mb-or-gb-human-readable-format\/#respond"]}]},{"@type":"Person","@id":"https:\/\/python-programs.com\/#\/schema\/person\/0f6d731bda7051ce3586f71299f391cd","name":"Satyabrata Jena","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/python-programs.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c1bf8033ec357d085f41815bee1625cc?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c1bf8033ec357d085f41815bee1625cc?s=96&d=mm&r=g","caption":"Satyabrata Jena"},"url":"https:\/\/python-programs.com\/author\/satyabrata\/"}]}},"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/posts\/5983"}],"collection":[{"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/comments?post=5983"}],"version-history":[{"count":4,"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/posts\/5983\/revisions"}],"predecessor-version":[{"id":18951,"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/posts\/5983\/revisions\/18951"}],"wp:attachment":[{"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/media?parent=5983"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/categories?post=5983"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/tags?post=5983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}