Horje
python calculator file size to megabytes Code Example
python calculator file size to megabytes
import math

def convert_size(size_bytes):
   if size_bytes == 0:
       return "0B"
   size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
   i = int(math.floor(math.log(size_bytes, 1024)))
   p = math.pow(1024, i)
   s = round(size_bytes / p, 2)
   return "%s %s" % (s, size_name[i])




Python

Related
python is inf Code Example python is inf Code Example
pandas series remove element by index Code Example pandas series remove element by index Code Example
jupyter matplotlib Code Example jupyter matplotlib Code Example
decode html python Code Example decode html python Code Example
purpose of meta class in django Code Example purpose of meta class in django Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7