Making the Zen of Python more useful

Aloysio Figueiredo xpythonist at yahoo.com.br
Fri Apr 2 16:35:51 EST 2004


>>> import sys
>>> t,sys.stdout = sys.stdout, file('/dev/null', 'w')
>>> from this import s
>>> sys.stdout = t
>>> s.decode('rot-13')
u"The Zen of Python..."
>>>

:) :)

Aloysio

 --- Andrew Henshaw <andrew.henshaw at gtri.gatech.edu> escreveu: > In
article <mailman.284.1080928147.20120.python-list at python.org>, 
> n3613 at klaff.org says...
> >
> >
> >from this import s
> >s.decode('rot13')
> >
> Thanks for the response.  Unfortunately, this still has the
> (generally 
> desired) behavior of the text being printed to stdout.  For the less
> general 
> case of using the text to feed some test code, I don't think that is
> best.  
> Unfortunately, I can't think of a way to accomplish both by simply
> modifying 
> the 'this' module (for future releases).  Adding another module would
> do it; 
> but, I was hoping someone could suggest a better way.  
> 
> -- 
> Andy
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list 

______________________________________________________________________

Yahoo! Mail - O melhor e-mail do Brasil! Abra sua conta agora:
http://br.yahoo.com/info/mail.html




More information about the Python-list mailing list