For the OP, Kevin did a good job showing the pseudocode, and each step.This will run in the same fashion.
#!/usr/bin/env python
import sys
n = 0
with open(sys.argv[1], 'r') as f:
with open(sys.argv[2], 'w') as out:
for line in f:
n += 1
out.write('>' + str(n) + '\n' + line.strip())