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 :: blackjack in python 
Python :: Tkinter button icons 
Python :: python get last key in dict 
Python :: python join paths 
Python :: You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. 
Python :: python datetime add one week 
Python :: get columns that contain null values pandas 
Python :: Creating virtual environments 
Python :: count gabarit django 
Python :: pandas get column names with nan 
Python :: how to show pandas last record 
Python :: facerecognizer python 
Python :: replace nan with mean 
Python :: make calculator in python 
Python :: python no such file python3 
Python :: post request python 
Python :: python flask mail 
Python :: change default python version 
Python :: python print user input 
Python :: django staff_member_required decorator 
Python :: python live video streaming flask 
Python :: remove alphabetic characters python 
Python :: sum values in django models 
Python :: pytest parametrize 
Python :: minimum-number-of-steps-to-reduce-number-to-1 
Python :: pil image to numpy array 
Python :: how to convert img to gray python 
Python :: pathlib path get directory of current file 
Python :: drop row pandas 
Python :: read a file and split the words python 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =