I would like to run a command in Python Shell to execute a file with an argument.
For example: execfile("abc.py") but how to add 2 arguments?
execfile("abc.py")
try this:
import sys sys.argv = ['arg1', 'arg2'] execfile('abc.py')
Note that when abc.py finishes, control will be returned to the calling program. Note too that abc.py can call quit() if indeed finished.
abc.py
quit()
2.1m questions
2.1m answers
60 comments
57.0k users