What is “argv”, and what does it do?

前端 未结 7 1679
耶瑟儿~
耶瑟儿~ 2020-11-30 04:36

argv

What on Earth is it!?

Edit: If you can, will you please write a line or two and explain how it works?

7条回答
  •  失恋的感觉
    2020-11-30 04:51

    It means arguments vector and it contains the arguments passed to the program. The first one is always the program name.

    For example, if you executed your Python program like so...

     $ python your_script.py --yes
    

    ...then your sys.argv will contain your_script.py and --yes.

提交回复
热议问题