-1

Program [ex13.py]:

import sys
a = raw_input("Input 3rd variable:")
print "The script is called:", sys.argv[0]
print "Your first variable is:", sys.argv[1]
print "Your second variable is:", sys.argv[2]
print "Your third variable is:", a

Executing in command prompt: ex13.py 1 3

How to run this from the python shell by giving the argv ?

  • possible duplicate of [Calling an external command in Python](http://stackoverflow.com/questions/89228/calling-an-external-command-in-python) – luk32 May 23 '14 at 11:34

1 Answers1

0

If you want to get the output you can do this:

from subprocess import Popen, PIPE

process = Popen(os.path.dirname("python ex13.py 1 3", shell=True, stdout=PIPE)

output = process.communicate()
exit_code = process.wait();
woverton
  • 441
  • 1
  • 3
  • 12