deref in a string into an operand

Peter Abel PeterAbel at gmx.net
Fri Nov 5 15:44:54 EST 2004


John Doe <atterdan at yahoo.com> wrote in message news:<pan.2004.11.05.08.00.19.364836 at yahoo.com>...
> I've got the action '+' stored as the variable 'plus',
> that is plus='+'
> 
> Now I want to use the variable plus in an equation:
> 5 plus 7, just line 5 + 7
> 
> How do I do that?
> 
> Dan

If you want a string:
equation = '5 '+plus+' 7'

or 

equation = '5 %s 7' % plus

Regards
Peter



More information about the Python-list mailing list