On Sat, 03 Feb 2007 13:30:14 -0800, David Joyner <[EMAIL PROTECTED]> wrote:

> This is more pythonic, but: is it possible to create a string that is
> a well-formed argument to 'print', so that 'print' will print what
> that argument dictates?
>My naive attempts have not worked, and I am wondering whether it can
> be done.
>This is the sort of thing I'm shooting for:
>s1 = '\"%s\"%6'
> print s1
>I'd like something other than '"%s"%6' to show up :=}

No.   But instead you could do print eval(s1):

sage: s1 = '\"%s\"%6'
sage: s1
'"%s"%6'
sage: print eval(s1)
6

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-forum
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to