ulauncher Extension for A Python Expression Evaluator.
Evaluate the formula using Python eval()
.
Arithmetic Operation:
expr 1 + 1 = 2
expr 2 * 4 = 8
Math
Functions:
expr math.pow(2, 5) = 32.0
expr math.floor(10.5) = 10.0
expr 1000 >> 1 = 500
expr 'x' == 'x' = True
Python String Format Examples
:
expr '{0}, {1}!'.format('hello', 'world') = hello, world!
expr '%s, %s!' % ('hello', 'world') = hello, world!
expr 'py' * 3 = pypypy
expr '{:,}'.format(10000000) = 10,000,000
When you want float result, concat .0
to expression:
expr 10 / 3 = 3
expr 10 / 3.0 = 3.33333333
You can use braket:
expr 2 + 2 * 2 = 6
expr ( 2 + 2 ) * 2 = 8
IMPORTANT Restricted to use only math
Functions:
expr dir() // name 'dir' is not defined
IMPORTANT Python's eval
function can be dangerous.
global variables are restricted to use only math
Functions. But use careful.
There are a variety of issues with the vulnerability, but the following documents provide a brief overview.
- ulauncher
- Python >= 2.7
Open ulauncher preferences window -> extensions -> add extension and paste the following url:
https://github.com/luasenvy/ulauncher-expr
Calculator Icon by Eezy in E-commerce And Shopping find with iconfinder
Creative Commons (Attribution-Share Alike 3.0 Unported)
git clone https://github.com/luasenvy/ulauncher-expr
cd ~/.local/share/ulauncher/extensions/
ln -s <repo_location>
To see your changes, stop ulauncher and run it from the command line with:
ulauncher -v
MIT