Skip to content

lennon-guan/pyexpr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A python expression evaluate library

Installation

pip install pyexpr

Usage

  • Simple evaluation
assert pyexpr.evaluate('1 + 2 * (3 - 4) **2') == 3
  • With functions
assert pyexpr.evaluate('1 + 2 * (3 - 4) ** sqrt(4)', builtins=dict(sqrt=math.sqrt)) == 3
  • With variables
assert pyexpr.evaluate('1 + 2 * (3 - 4) ** X', variables=dict(X=4)) == 3

You can find more examples in test.py

About

A python expression evaluation library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages