Exercise 13 - parameters, unpacking, variables

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 vaiable is:", third)

output

PS: 在终端输入参数

D:\>python ex13.py 1st 2ed 3rd
The script is called: ex13.py
Your first variable is: 1st
Your second variable is: 2ed
Your third vaiable is: 3rd

2019-09-27

16:17:09

猜你喜欢

转载自www.cnblogs.com/petitherisson/p/11597129.html