Description
A CLI tool to convert numbers between bases, with as little typing as possible.
$ bs FFFE
[from hexadecimal]
decimal 65534
binary 1111111111111110
octal 177776
$ bs -t d F
15
Installation
This is a Python 3 script, installed from PyPI using pip.
pip3 install base-convert-cli
Hasn't been tested on Windows.
Examples
If you don't specify a base, it does all common conversions.
$ bs 0
[from decimal]
binary 0
hexadecimal 0
octal 0
[from binary]
<clipped output here>
Specify the base through the prefix 0b for binary, 0o for octal, 0d for decimal and 0x for hex.
$ bs 0xF
bs 0xF
[from hexadecimal]
decimal 15
binary 1111
octal 17
Specifying base through a flag.
$ bs --from hex F
[from hexadecimal]
decimal 15
binary 1111
octal 17
From base-36 (the maximum supported base, which uses the digits 0-9 and then a-z).
$ bs --from 36 zx1
[from base-36]
decimal 46549
binary 1011010111010101
hexadecimal B5D5
octal 132725
To base-7.
$ bs --to 7 54
[from decimal]
base-7 105
[from hexadecimal]
base-7 150
[from octal]
base-7 62
Specifying both input and output bases.
$ bs --from hex --to dec F
15
Shorthand for lazy people.
$ bs -f h -t d F
15
Padding with zeroes.
$ bs --from decimal --to binary --pad 8 14
00001110
Setting precision for converting fractional numbers.
$ bs --prec 10 --from 3 --to decimal 0.1
0.3333333333
Aaaaand input through a pipe.
$ echo '5+10' | bc | bs -t h
[from decimal]
hexadecimal F
[from octal]
hexadecimal D
Contributing
Feel free to submit tweaks. To run tests, install tox via pip3 install tox and then run the tox command from the base directory.
Metadata
Release files for base-convert-cli 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| base-convert-cli-1.0.3.tar.gz | 5.5 kB | Without provenance | Details for base-convert-cli-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| base_convert_cli-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for base_convert_cli-1.0.3-py3-none-any.whl |
Total release size: 11.7 kB
Release files / base-convert-cli-1.0.3.tar.gz
| Download URL | base-convert-cli-1.0.3.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c97f5b19db0f4040b3ba1a5fb29af470e831cc971d487847827ef30c3861092
|
|
BLAKE2b-256 checksum How to use checksums |
7609432db6908ade9c1f76aee1cd9ad42da50f2f830f60d3e9320cbab9ed24b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.24.0 requests-toolbelt/0.9.1 urllib3/1.25.10 tqdm/4.62.0 importlib-metadata/1.6.1 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.9
|
Release files / base_convert_cli-1.0.3-py3-none-any.whl
| Download URL | base_convert_cli-1.0.3-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
da5661b18958ae3e418493d8c9d5ede55e370f511629ff37944aad2f74fd2387
|
|
BLAKE2b-256 checksum How to use checksums |
47dfbc00517b8b86e13c71d48232e8b80b0e50fd74daf41a04eec21fcb677cac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.24.0 requests-toolbelt/0.9.1 urllib3/1.25.10 tqdm/4.62.0 importlib-metadata/1.6.1 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.9
|
Security for base-convert-cli 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.