My environment uses Python 2.6 and I'm new to Python. I need to write a script that runs a file decoding command which takes several arguments from the command line. My problem is I can't parse arguments taken from the terminal to the file decoding command.
For example if my program name is x.py and when i run "x.py Desktop/abc.txt" how can i pass Desktop/abc.txt as an argument to the cat command?
import commands
import sys
a=open("b.txt","w")
a.write(commands.getoutput('cat sys.argv[1]'))
When i researched it seemed that the above program should work but it didn't. Please help.