import os, subprocess, time os_filename = "tmp_os" sub_filename = "tmp_subprocess" def write_file(filename): # write out a reasonably big file fh = file(filename, 'w') for i in xrange(100000): print >>fh, i fh.close() write_file(os_filename) write_file(sub_filename) start = time.time() read_handle = os.popen('cat %s' % os_filename) a = [i for i in read_handle] print "time with os.popen : ", time.time() - start start = time.time() read_handle = subprocess.Popen(['cat', sub_filename], stdout=subprocess.PIPE).stdout a = [i for i in read_handle] print "time with subprocess.Popen : ", time.time() - start os.unlink(os_filename) os.unlink(sub_filename)