0

python myprgm.py "pathofsome" "a.py"

python myprgm.py -file "pathofsome" "*.c"

These are command line arguments that I will be giving in my program.How to do this? I have to execute as a single program.How can I do this in commandline argument in python?

  • 2
    `import sys` then call `sys.argv` which is a list containing all the commands that were thrown to open the python interpreter. However, what is the purpose of calling two .py files in the same command-line? There might be another way to solve that problem. – Hampus Larsson May 27 '20 at 12:22
  • 1
    Does this answer your question? [How to read/process command line arguments?](https://stackoverflow.com/questions/1009860/how-to-read-process-command-line-arguments) – Kyle Parsons May 27 '20 at 18:27

1 Answers1

0

You can use argparse module to handle command line arguments. argparse is built in python module.

Here is the official argparse documentation

Hirusha Fernando
  • 1,156
  • 10
  • 29