Convert float string (decimal point or decimal comma) to float
Project description
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 😘
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file str2float-0.0.9.tar.gz.
File metadata
- Download URL: str2float-0.0.9.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
097eee4adbbd101e45feb2675caebf995fa783d1d4c4f01e912ed2f79f050d7e
|
|
| MD5 |
b99c5a1fbc0fa7be93b092a61929cca7
|
|
| BLAKE2b-256 |
871c3732153def4dca25a9d42df4b3c68f9620ac179bca2faa2bd553316b3381
|
File details
Details for the file str2float-0.0.9-py3-none-any.whl.
File metadata
- Download URL: str2float-0.0.9-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6aa194116dc8c995e6740e3bd01b804fe1d1e9e3dbb11deb921d9b9cdb973eb1
|
|
| MD5 |
f296608f95b16f8e2efc9ac04331eff4
|
|
| BLAKE2b-256 |
70091422e6f550147dcea8e20d3d390dd9489f13e5a33abc9692a29ede9e1560
|