In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > Roy Smith <[EMAIL PROTECTED]> wrote: > >In article <[EMAIL PROTECTED]>, > > Ron Garret <[EMAIL PROTECTED]> wrote: > >> In article <[EMAIL PROTECTED]>, > >> "Erik Bethke" <[EMAIL PROTECTED]> wrote: > >>> > >>> I have NEVER experienced this kind of programming joy. > >> > >> Just wait until you discover Lisp! > > Taking this more seriously than it deserves, I've tried poking at Lisp a > couple of times -- each time, I walk away shaking my head in disgust. > Lisp just ain't as *READABLE* as Python.
Readability is in the eye of the beholder, but this is not the place to argue this. But this topic does bring up a legitimate question: I have a bunch of code that generates HTML using PRINT statements. I need to convert all this code to return strings rather than actually printing them (so I can use the results to populate templates). In Lisp I could do this: (with-output-to-string (s) (let ( (*standard-output* s) ) (call-html-generating-code) s)) Is there an equivalent Python trick to capture a function call's output as a string? Thanks, rg -- http://mail.python.org/mailman/listinfo/python-list