I need to create a wrapper script that gets parameters from the shell and that passes all of them as they are, to another script.
In Perl, I would do:
system("/path/to/subprocess", @ARGV);
Is there a way to do the same thing in Python?
Call subprocess.call
with sys.argv
minus the first element, which is the name of your Python script.
import subprocess
import sys
subprocess.call(["/path/to/subprocess"] + sys.argv[1:])
Example with date
as the subprocess:
$ python3 s.py
Tue Oct 21 09:25:00 CEST 2014
$ python3 s.py -R
Tue, 21 Oct 2014 09:25:01 +0200
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.