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
str2float-0.0.9.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for str2float-0.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6aa194116dc8c995e6740e3bd01b804fe1d1e9e3dbb11deb921d9b9cdb973eb1 |
|
MD5 | f296608f95b16f8e2efc9ac04331eff4 |
|
BLAKE2b-256 | 70091422e6f550147dcea8e20d3d390dd9489f13e5a33abc9692a29ede9e1560 |