You can use the Python function eval . Here is an example:
from z3 import * x,y,z = Ints('xy z') s = 'x + y + 2*z == 5' F = eval(s) solve(F)
This script displays [y = 0, z = 0, x = 5] on my machine.
Unfortunately, we cannot execute this script at http://rise4fun.com/z3py . The rise4fun site rejects Python scripts containing eval (for security reasons).
source share