-3

I have an executable external program that ask the name of the arguments file.

I am trying to program this action through python coding. How can it be done?

jmparejaz
  • 160
  • 1
  • 14

2 Answers2

2

if you want to run exe file you can use:

import os
path = "exe-file-path.exe"
os.system("start " + path)

os library is built-in (both python 2,3)

0

You must use sys and os module and here is sample code:

import sys
import os

if sys.argv[1] == "something":
    # Do something

Remember that sys.argv[0] is script itself and sys.argv[1] is first argument like example.py first_argument. If first argument can be other things [and other arguments if available], just add more variants. If it has more arguments, just add elif sys.argv[%next number%] == "something": # Do something. And also replace # Do something with valid command to do when that argument is choosen.

UltraStudioLTD
  • 300
  • 2
  • 14