Try this:
class stdoutflip: def __init__(self, sys): self.stdout = sys.stdout sys.stdout = self def write(self, txt): txt = list(txt) txt.reverse() self.stdout.write(''.join(txt)) class stdoutupper: def __init__(self, sys): self.stdout = sys.stdout sys.stdout = self def write(self, txt): self.stdout.write(txt.upper())
To test it do this:
out = stdoutupper(stdoutflip(sys))
Now try printing stuff:
print "Hello Python!"
Hamid Alipour is a partner in Codehead, LLP with his wife, Tess. Hamid speaks 12 markup and programming languages [Yes, 12: PHP, CSS, Ajax, JavaScript, HTML/XHTML, Java, Python, C/C++, ASP, Visual Basic, Scheme and Action Script]; has a penchant for solving the unsolvable; an affinity for clean, hand-written code and is a Zend Certified 