mathparse
The mathparse library is a Python module designed to evaluate mathematical equations contained in strings.
Here are a few examples:
from mathparse import mathparse
mathparse.parse('50 * (85 / 100)')
>>> 42.5
mathparse.parse('one hundred times fifty four', mathparse.codes.ENG)
>>> 5400
mathparse.parse('(seven * nine) + 8 - (45 plus two)', language='ENG')
>>> 24
Installation
pip install mathparse
Language support
The language parameter must be set in order to evaluate an equation that uses word operators.
The language code should be a valid ISO 639-2_ language code.
History
See release notes_ for changes.
.. _ISO 639-2: https://www.loc.gov/standards/iso639-2/php/code_list.php
.. _release notes: https://github.com/gunthercox/ChatterBot/releases
Metadata
Release files for mathparse 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mathparse-0.1.5.tar.gz | 10.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mathparse-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.4 kB
Release files / mathparse-0.1.5.tar.gz
| Download URL | mathparse-0.1.5.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bfdb84eed7862229f0fd34f72fa3ed2a2adfcecad8985020f4cdcd5fc2c197d7
|
|
BLAKE2b-256 checksum How to use checksums |
df4aadcb320ec1554c6b09dafbcece0cec78772c73e3283150f306633addbcde
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|
Release files / mathparse-0.1.5-py3-none-any.whl
| Download URL | mathparse-0.1.5-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3cbfdc89f942c50b9915dc272e8acbe03b0134c8b183291367c80bf16e0eee1e
|
|
BLAKE2b-256 checksum How to use checksums |
6bfd197e744cfc1cbd75df2dc7052be98729de3b99bb906b2aa4f1c2ca0604e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|