From: Jean-Michel Pichavant on
Paul Lemelle wrote:
> HELP! :)
>
> I am trying to output the following program's output to either a file
> or variable, how can this be done?
>
> # Writing the output to a standard argv argument
>
> #1/usr/bin/python
>
> import sys
>
> for arg in sys.argv:
> print arg
>
> #END
>
> Thanks,
> Paul
>
>
Hi Paul, after reading 4 times your post, I still don't see what you
want to achieve.
What are you calling a variable ? an os variable ?

import sys

file = open('testfile.txt', 'w')
file.write(str(sys.argv))
file.close()

second hit when googling your question:
http://docs.python.org/tutorial/inputoutput.html

JM