Mega Code Archive

 
Categories / Python Tutorial / Buildin Function
 

Eval combines values from dictionary

scope = {}  scope['x'] = 2  scope['y'] = 3  eval('x * y', scope)  scope = {} exec 'x = 2' in scope eval('x*x', scope)