Subdomain Posts
Python | 848 days ago
Python | 848 days ago
Python | 868 days ago
Recent Posts
None | 6 sec ago
None | 13 sec ago
None | 25 sec ago
HTML | 27 sec ago
None | 28 sec ago
None | 31 sec ago
None | 36 sec ago
None | 40 sec ago
None | 43 sec ago
Bash | 1 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By bulkan on the 4th of Nov 2007 01:01:06 PM Download | Raw | Embed | Report
  1. import StringIO
  2. import sys
  3.  
  4. class StdOut(StringIO.StringIO):
  5.     def __init__(self,stdout):
  6.         self.__stdout =  stdout
  7.         StringIO.StringIO.__init__(self)
  8.  
  9.     def write(self,s):
  10.         self.__stdout.write(s)
  11.         StringIO.StringIO.write(self,s)
  12.  
  13.     def read(self):
  14.         self.seek(0)
  15.         self.__stdout.write(StringIO.StringIO.read(self))
  16.  
  17. if __name__ == '__main__':
  18.     s = StdOut(sys.stdout)
  19.     sys.stdout = s
  20.  
  21.    
  22.     print "first print"
  23.     print "second print"
  24.  
  25.     s.read()
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: