str2float
There are 3 ways to group the number ten thousand with digit group separators:
- Space: the internationally recommended thousands separator.
- Point: the thousands separator used in many non-English speaking countries.
- Comma: the thousands separator used in most English-speaking countries.
In which, there are 2 types of decimal separators:
- Decimal point
- Decimal comma
This package will help convert float string (decimal point or decimal comma) to float!
Installation:
https://pypi.org/project/str2float/
pip install str2float
Usage:
from str2float import str2float
float = str2float(str_float)
Example:
from str2float import str2float
if __name__ == "__main__":
assert str2float("1") == 1.0
assert str2float("1.2345") == 1.2345
assert str2float("1.23") == 1.23
assert str2float("1.2") == 1.2
assert str2float("1,2345") == 1.2345
assert str2float("1,23") == 1.23
assert str2float("1,2") == 1.2
assert str2float("1234,5") == 1234.5
assert str2float("1.234,5") == 1234.5
assert str2float("1,234.5") == 1234.5
assert str2float("1,234,567.85") == 1234567.85
assert str2float("1.234.567,85") == 1234567.85
From hoangyell with love 😘
Release files for str2float 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| str2float-0.0.9.tar.gz | 2.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| str2float-0.0.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.1 kB
Release files / str2float-0.0.9.tar.gz
| Download URL | str2float-0.0.9.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
097eee4adbbd101e45feb2675caebf995fa783d1d4c4f01e912ed2f79f050d7e
|
|
BLAKE2b-256 checksum How to use checksums |
871c3732153def4dca25a9d42df4b3c68f9620ac179bca2faa2bd553316b3381
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.8
|
Release files / str2float-0.0.9-py3-none-any.whl
| Download URL | str2float-0.0.9-py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6aa194116dc8c995e6740e3bd01b804fe1d1e9e3dbb11deb921d9b9cdb973eb1
|
|
BLAKE2b-256 checksum How to use checksums |
70091422e6f550147dcea8e20d3d390dd9489f13e5a33abc9692a29ede9e1560
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.8
|