What does 'sys.argv' mean?

后端 未结 4 1010
后悔当初
后悔当初 2020-12-09 07:13

I am learning from code, and I am get confused by one of its lines which is:

things = [float(arg) for arg in sys.argv[1:]]
Omega_a, Omega_b, Delta_a, Delta_b         


        
4条回答
  •  北荒
    北荒 (楼主)
    2020-12-09 07:25

    sys.argv are called "command line parameters". If you want to pass them, you should run you script from a command line. On a Windows system the command would look like:

    cmd> python C:\Users\testcode.py arg1 args2
    

    where "cmd>" is the prompt you get after using "Start"->"Run".

提交回复
热议问题