Skip to main content

Convert Bytes to Megabyte, Kilobyte and ...

Project description

Please visit https://github.com/mlibre/byte_to_humanity
This document copied from above link.

# Byte to Humanity
Simple Python 3 module that Convert Bytes to Megabyte, Kilobyte and ...

## Table of Contents
* Install
+ with pip
+ with git
* Example
* License
* More
* Step By Step example


### Install
+ with pip

sudo pip3 install byte_to_humanity
or
sudo pip install byte_to_humanity

+ with git

git clone "https://github.com/mlibre/byte_to_humanity.git"
cd byte_to_humanity/
sudo python setup.py install

### Example
from byte_to_humanity.bth import convert_byte_to

bytes = 2048

print( bytes, 'byte =' , str( convert_byte_to( bytes , 'k') ) , 'kilobyte')
print( bytes, 'byte =' , str( convert_byte_to( bytes , 'm') ) , 'megabyte')
print( bytes, 'byte =' , str( convert_byte_to( bytes , 'g') ) , 'gigabyte')
print( bytes, 'byte =' , str( convert_byte_to( bytes , 't') ) , 'terabyte')
print( bytes, 'byte =' , str( convert_byte_to( bytes , 'p') ) , 'petabyte')

### License
This project has no license!. You may consider this as Public Domain or CC0. also you can see license file.

### More
+ Step By Step example

1. Open terminal.
2. Create a file like test.py.
3. Copy and past down code in test.py.

from byte_to_humanity.bth import convert_byte_to

bytes = 2048

print( bytes, 'byte =' , str( convert_byte_to( bytes , 'k') ) , 'kilobyte')
print( bytes, 'byte =' , str( convert_byte_to( bytes , 'm') ) , 'megabyte')
print( bytes, 'byte =' , str( convert_byte_to( bytes , 'g') ) , 'gigabyte')
print( bytes, 'byte =' , str( convert_byte_to( bytes , 't') ) , 'terabyte')
print( bytes, 'byte =' , str( convert_byte_to( bytes , 'p') ) , 'petabyte')

4. Run code.

python3 test.py
or
python test.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
byte_to_humanity-1.5.tar.gz (3.5 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page