Explain the argv function in Python?

python

#1

Hello

I am writing this code:

from sys import argv
script, first, second, third = argv
 #Pressed enter
 #Below is the error i am getting

Traceback (most recent call last):
ValueError: need more than 1 value to unpack

Can someone please explain, how can I tackle this?


#2

@copernicus_21

Use below code, it will solve your problem. I have taken only four values from argv because you have only four variables to take input.

from sys import argv
script, first, second, third = argv[:4]

Regards,
Satish