parsing equations
Diez B. Roggisch
deets_noospaam at web.de
Tue Dec 9 09:53:26 EST 2003
More information about the Python-list mailing list
Tue Dec 9 09:53:26 EST 2003
- Previous message (by thread): parsing equations
- Next message (by thread): parsing equations
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> i have a question.
> Given the string '3+2*6' i need to parse it and obtain the result, so
> 15. Does a module for this operation exists? i need to do simple
> operations, but also on floating point numbers.
Use the builtin function eval to evaluate an arbitrary python expression:
>>> eval("3+2*6")
15
Regards,
Diez
- Previous message (by thread): parsing equations
- Next message (by thread): parsing equations
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list