#!/usr/bin/env python # encoding: utf-8 # # Copyright (c) 2008 Doug Hellmann All rights reserved. # """ """ __version__ = "$Id$" #end_pymotw_header import tempfile f = tempfile.TemporaryFile(mode='w+t') try: f.writelines(['first\n', 'second\n']) f.seek(0) for line in f: print line.rstrip() finally: f.close()