Skip to main content

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', language='ENG')
>>> 5400

mathparse.parse('(seven * nine) + 8 - (45 plus two)', language='ENG')
>>> 24

Security

Mathparse does not employ the use of Python's eval function when evaluating provided mathematical expressions. This is a measure to prevent arbitrary code execution vulnerabilities. See https://mathparse.chatterbot.us/postfix/ for additional details.

Mathparse is a standalone Python package and requires zero dependencies to function.

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.

Installation

pip install mathparse

Documentation

See the full documentation at https://mathparse.chatterbot.us

Changelog

See release notes for changes.

Metadata

Release files for mathparse 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mathparse 0.2.3
File Size Uploaded
mathparse-0.2.3.tar.gz 19.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mathparse 0.2.3
File Interpreter ABI Platform
mathparse-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 33.8 kB

Release files / mathparse-0.2.3.tar.gz

Download URL mathparse-0.2.3.tar.gz
Size 19.0 kB
Tags Source
SHA-256 checksum
How to use checksums
98f185209b2a1e626f959a2706091e10b72acd84bef39b9438e3a69c1c8c9c6a
BLAKE2b-256 checksum
How to use checksums
8a2b0fd160ebe1f3d92eef6f150fbea159dd6d83c3ea11745aef82605b7bd726
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.2.3-py3-none-any.whl

Download URL mathparse-0.2.3-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
299ee561420e22c73a1d10e303f195a5c3d26cf68c1826d7d98c2e25ed933390
BLAKE2b-256 checksum
How to use checksums
5279dba3a8f94f3999fcfbfab34f92bb5ced2f1df03076bcb7e678ab88b46c5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Release history Release notifications | RSS feed

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.2

2 release files

0.1.1

3 release files

0.1.0

2 release files

0.0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page