学习python第(n’)天——我在看笨办法学python(参数,解包,变量)
作者:互联网
这是所有的语言
from sys import argv
#read the WYSS section for how to run this.
#ex3.py是参数。
# argv 是参数变量(argument variable)。
#import的作用是调用参数特性,这些导入的特性称为模块(module)或库(library)。
script, first, second, third = argv
#这是一个解包(unpack)过程。
print ("The script is called:", script)
print ("Your first variable is:", first)
print ("Your second variable is:", second)
print ("Your third variable is:", third)
# python ex2.py first second third(遇到argv,运行时得千万注意)
#这些是《笨办法学编程》page.38-40的内容。
这是所有的运行结果
PS C:\Users\HH\lpthw> python ex2.py first second third
The script is called: ex2.py
Your first variable is: first
Your second variable is: second
Your third variable is: third
PS C:\Users\HH\lpthw>
标签:笨办法,third,script,python,解包,print,second,variable,first 来源: https://www.cnblogs.com/NanShi112116/p/15632469.html