Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

convert mb to gb python

try:
    MB = int(input("How much MB:- "))
    conversion = MB / 1024
    print(conversion," GB")
except ValueError:
    print("MB must be in numerical format not the char format")
    #numerical format --> integer
    #char format --> string
Comment

bytes to kb mb gb python

def convert_bytes(bytes_number):
    tags = [ "Byte", "Kilobyte", "Megabyte", "Gigabyte", "Terabyte" ]
 
    i = 0
    double_bytes = bytes_number
 
    while (i < len(tags) and  bytes_number >= 1024):
            double_bytes = bytes_number / 1024.0
            i = i + 1
            bytes_number = bytes_number / 1024
 
    return str(round(double_bytes, 2)) + " " + tags[i]
 
 
print(convert_bytes(4896587482345))
print(convert_bytes(9876524362))
print(convert_bytes(10248000))
print(convert_bytes(1048576))
print(convert_bytes(1024000))
print(convert_bytes(475445))
print(convert_bytes(1024))
print(convert_bytes(75))
print(convert_bytes(0))
Comment

how to convert gb to mb in python

try:
    gb = int(input("How much Gb:- "))
    conversion = gb * 1024
    print(conversion," MB")
except ValueError:
    print("GB must be in numerical format not the char format")
    #numerical format --> integer
    #char format --> string
Comment

PREVIOUS NEXT
Code Example
Python :: how to return an html file in flask 
Python :: how to check if given number is binary in pytho 
Python :: python dict print keys 
Python :: seaborn define linewidth 
Python :: pandas rename column by index 
Python :: Scaling Operation in SkLearn 
Python :: pandas merge on columns different names 
Python :: keras.layers.MaxPool2D 
Python :: python float to 2 decimals 
Python :: python beginner practice problems 
Python :: save a torch tensor 
Python :: django ckeditor not working 
Python :: python fill a list 
Python :: python date iso 8601 
Python :: find largest 10 number in dataframe 
Python :: The specified file cannot be played on the specified MCI device. The file may be corrupt, not in the correct format, or no file handler available for this format. python 
Python :: Conversion of number string to float in django 
Python :: how to check if a list is a subset of another list 
Python :: count the number of rows in a database table in Django 
Python :: how to distribute a dataset in train and test using scikit 
Python :: python datetime strftime 
Python :: tkinter yes no dialogue box 
Python :: read tsv with python 
Python :: Django less than and greater than 
Python :: fastapi json request 
Python :: Replace the string with NAN value 
Python :: axes color python 
Python :: shebang python 
Python :: corr pandas 
Python :: python get desktop directory 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =