I need a python program to be called and take the output while another program is running. To do this i created an .exe
file, but after 2 days I finally realised that, for some reason, the sklearn
library doesn't work in .exe
files. Is there any other way to run a script and get the output that doesn't include an .exe
file?
In your command line, you call your python like this
python test.py arg1 arg2 arg3
In your python, you get the parameters from the command line by sys.argv
import sys
print 'Number of arguments:', len(sys.argv), 'arguments.'
print 'Argument List:', str(sys.argv)
You will get output
Number of arguments: 4 arguments.
Argument List: ['test.py', 'arg1', 'arg2', 'arg3']
sys.argv
is a list. You call them like sys.argv[1]
, where 1
could be 0
, 1
, 2
or 3
in this case.
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.