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 :: get list file in folder python 
Python :: python selenium web scraping example 
Python :: set cookie in chrome 
Python :: count rows with nan pandas 
Python :: python use variable in another file 
Python :: python remove all unicode from string 
Python :: python rgb colors 
Python :: write results in csv file python 
Python :: python copy an object 
Python :: pandas xlsx to dataframe 
Python :: how to hide a turtle in turtle python 
Python :: python currency sign 
Python :: how to fill a list in python 
Python :: python ssh connection 
Python :: sum of all multiples of 3 and 5 below 100 
Python :: numpy normalize 
Python :: python 2 decimal places format 
Python :: how to download the captions of a youtube video 
Python :: is power of python recursion 
Python :: Changing the number of ticks on a Matplotlib plot axis 
Python :: or condition in pandas 
Python :: python get value from decimal object 
Python :: round down a number python 
Python :: change variable type python 
Python :: find the sum of all the multiples of 3 or 5 below 1000 python 
Python :: create a dataframe python 
Python :: MovieWriter stderr: ffmpeg: error while loading shared libraries: libopenh264.so.5: cannot open shared object file: No such file or directory 
Python :: replace value pandas df 
Python :: Issue TypeError: can’t multiply sequence by non-int of type str 
Python :: exeption python syntax 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =