学习python第(n’)天——我在看笨办法学python(参数,解包,变量)
2021/12/2 11:36:17
本文主要是介绍学习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>
这篇关于学习python第(n’)天——我在看笨办法学python(参数,解包,变量)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-08有遇到过吗?同样的规则 Excel 中 比Python 结果大
- 2024-03-30开始python成长之路
- 2024-03-29python optparse
- 2024-03-29python map 函数
- 2024-03-20invalid format specifier python
- 2024-03-18pool.map python
- 2024-03-18threads in python
- 2024-03-14python Ai 应用开发基础训练,字符串,字典,文件
- 2024-03-13id3 algorithm python
- 2024-03-13sum array elements python