binary-parser-0.0.4
توضیحات
convert integers to binary and vice-a-versa
| ویژگی | مقدار |
|---|---|
| سیستم عامل | Microsoft :: Windows :: Windows 10 |
| نام فایل | binary-parser-0.0.4 |
| نام | binary-parser |
| نسخه کتابخانه | 0.0.4 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Dhananjay Pai |
| ایمیل نویسنده | dhananjay2002pai@gmail.com |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/binary-parser/ |
| مجوز | MIT |
=============
binary_parser
=============
A python module where a number can be converted to its binary string and binary string to number.
**Note: binary string which will be recieved and provided will be in string format for early releases.**
``binary_parser``
**is a simple python library where users can convert an integer to its binary string and vice versa.**
Installation
============
::
pip install binary-parser
number-parser requires Python 3.6+.
Usage
=====
The library provides the following common use cases.
Converting a binary string to an integer
----------------------------------------
>>> import binary_parser
>>> binary_parser.parse_to_num('1011')
'11'
>>> binary_parser.parse_to_num('000')
'0'
>>> binary_parser.parse_to_num('01')
'1'
Converting an integer to its binary format
------------------------------------------
Arguments passed can be a string or an integer type.
>>> import binary_parser
>>> binary_parser.parse_to_binary('7')
'111'
>>> binary_parser.parse_to_binary(1)
'1'
>>> binary_parser.parse_to_binary('0')
'0'
Checking if given string is binary or integer
---------------------------------------------
>>> import binary_parser
>>> binary_parser.which_parser('1010')
'Input 1010 could be either binary or a number'
"binary string: 1010 number: 10"
>>> binary_parser.which_parser(12)
'Input 12 is a number'
"number: 12"
>>> binary_parser.which_parser('00101')
'Input 00101 could be either binary or a number'
"binary string: 00101 number: 101"
>>> binary_parser.which_parser(b'10011')
'Input b'10011' is a binary string'
"binary string: b'10011'"
Change Log
==========
0.0.1 (07/02/2022)
------------------
- First Release
0.0.2 (08/02/2022)
------------------
0.0.3 (08/02/2022)
------------------
0.0.4 (26/02/2022)
------------------
- bytes usage and readme changes
نحوه نصب
نصب پکیج whl binary-parser-0.0.4:
pip install binary-parser-0.0.4.whl
نصب پکیج tar.gz binary-parser-0.0.4:
pip install binary-parser-0.0.4.tar.gz