0

I have a program that have arguments are 3 files: 2pdf and 1 txt. I enter it on console with hands.

path_text = input("Enter path to text file ")
path_pdf_first = input("Enter path to fist pdf file ")
path_pdf_second = input("Enter path to second pdf file ")

How i can use this programm from cmd like this

python program.py *path1* *path2* *path3* 

Instead with hands and "Enter" again and again

0

1 Answer 1

1

Use sys.argv to take parameter using cmd

import sys
path_text = sys.argv[1] # parameter number 1
path_pdf_first = sys.argv[2] # parameter number 2
path_pdf_second = sys.argv[3] # parameter number 3

Note:

sys.argv[0] is the name of the script

Sign up to request clarification or add additional context in comments.

2 Comments

Thx its help me
@shadow1337, then please read this: What should I do when someone answers my question?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.