0

I recently came across this argv thing in python. What I've understood is that it is used for passing parameters using command line. Now, my questions are----

  1. Is argv command-line only? I mean can it be used for command-line programs only?
  2. If not, how do I use that in a program? Please share some example code.

Thanks in advance!!!!

amin2783
  • 1
  • 1
  • 2
    Does this answer your question? [sys.argv\[1\] meaning in script](https://stackoverflow.com/questions/4117530/sys-argv1-meaning-in-script) – Hampus Larsson Jun 12 '20 at 12:14
  • If you used `subprocess.run(["foo.py", "bar", "baz"])`, inside `foo.py` you would see that list as the value of `sys.argv`. No shell is involved; the shell is just one way to provide arguments to a script. – chepner Jun 12 '20 at 12:17

0 Answers0