python2和python3的argv怎么使用
展开全部
Python2的argv代码
from sys import argv
script, first, second, third = argv
print ("The script is called:", script)
print ("Your first variable is:", first)
print ("Your second variable is:", second)
print ("Your third variable is:", third)
这是python2的argv代码,在python3怎么更改
这是运行后的问题:
Traceback (most recent call last):
File "C:/Users/Su3/PycharmProjects/untitled4/参数、解包、变量.py", line 3, in <module>
script, first, second, third = argv
ValueError: not enough values to unpack (expected 4, got 1)
Process finished with exit code 1
from sys import argv
script, first, second, third = argv
print ("The script is called:", script)
print ("Your first variable is:", first)
print ("Your second variable is:", second)
print ("Your third variable is:", third)
这是python2的argv代码,在python3怎么更改
这是运行后的问题:
Traceback (most recent call last):
File "C:/Users/Su3/PycharmProjects/untitled4/参数、解包、变量.py", line 3, in <module>
script, first, second, third = argv
ValueError: not enough values to unpack (expected 4, got 1)
Process finished with exit code 1
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询