[code.view]

[top] / python / PyMOTW / pipes / pipes_file_kind.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2009 Doug Hellmann All rights reserved.
     #
     """
     """
     #end_pymotw_header
     
     import pipes
     import tempfile
     
     p = pipes.Template()
     p.append('cat $IN > $OUT', 'ff')
     p.debug(True)
     
     t = tempfile.NamedTemporaryFile('r')
     f = p.open(t.name, 'w')
     try:
         f.write('Some text')
     finally:
         f.close()
     
     t.seek(0)
     print t.read()
     t.close()
     

[top] / python / PyMOTW / pipes / pipes_file_kind.py

contact | logmethods.com