[Python-de] Webprogrammierung
Bertram Scharpf
b.scharpf at tesionmail.de
Fre Okt 8 15:00:27 CEST 2004
Hallo Harald,
erstmal danke für Deine ausführliche Mail.
Am Donnerstag, 07. Okt 2004, 11:36:01 +0200 schrieb Harald Armin Massa:
> etwas wie "aus StringIO nen pseudofile machen und mit print >> reinschreiben"
Nichts für ungut:
class Redirect:
def __init__( self):
import sys, StringIO
self.old = sys.stdout
self.out = sys.stdout = StringIO()
def __del__( self):
sys.stdout = self.old
def getvalue( self):
return self.out.getvalue()
def hallostr():
rd = Redirect()
print 'Hallo!'
return rd.getvalue()
Das müßte es gewesen sein.
Gruß
Bertram
--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de