What does 'sys.argv' mean?

后端 未结 4 997
后悔当初
后悔当初 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:20

    Parameters aren't the same as program input. For example, here's wget used with parameters:

    $ wget "I am a parameter!"
    

    Here's cat used with input:

    $ cat
    Now you type. This is the input.
    

    That's the reason for your error, too - you can't specify the parameters as such after you run the program.

提交回复
热议问题