Redirect output on script

Chris Rebert clp2 at
Thu Sep 17 21:41:08 CEST 2009

On Thu, Sep 17, 2009 at 3:58 AM, glenn.pringle at
<glenn.pringle at> wrote:
> I would like to redirect the output of the command below to another
> file
> type test.txt > test.bak
> I'm trying to do this as part of a python script running on Windows
> XP.
> I'm using os.system('type "filepath.txt > filepath.bak"') but nothing
> is happening.
> I was wondering if somebody could enlighten me.

Using the handy-dandy subprocess module:

bak = file('filepath.bak', 'w')['type', 'filepath.txt'], stdout=bak)


More information about the Python-list mailing list