This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
案例:(多类型传值、传值冗余) | |
多类型传值: | |
1、向函数传元祖和字典 (传值的时候,*一个代表元祖,**两个代表字典) | |
2、处理多余实参 | |
############################################# | |
>>> print "%s : %s" % (12,23) # 一个%s 代表一个元素, 用%来传 | |
12 : 23 | |
print打印的值是最后赋给它的用("%s : %s" %)的形式传值,值也要用括号() 来定义。 | |
>>>t = 'name',"milo" #t 等于两个字符串 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
案例:(返回数字绝对值、计算数据) | |
函数返回值: | |
函数被调用后会返回一个指定的值: | |
函数调用后默认返回None: | |
return(语句) 返回值: | |
返回值可以是任意类型:(任何序列、元祖、列表、字典) | |
return执行后,函数终止 : | |
>>> def a(x,y): | |
... if x<y: #做一个判断当x小于y,返回值为1 | |
... return 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
局部变量和全局变量: | |
python中的任何变量都有其特定的作用域; | |
1、只能在函数内部使用,这些只能在程序的特定部分使用的变量我们称之为局部变量; | |
2、在文件顶部定义的变量可以供该文件中的任何函数调用,这些可以为整个程序所使用的变量称为全局变量。 | |
 | |
函数就是完成特定功能的一个语句组,这组语句可以做为一个单位使用,并且给它取一个名字。 | |
我们可以通过函数名在程序的不通地方多次执行和使用(这通常叫做函数调用) | |
自定义函数(自己编写的) | |
预定义函数(python系统自带的函数,也可以是其它程序员写的一些函数,我们都可以直接拿来使用) | |
使用函数可以降低编程的难度,代码重复用。。。 | |
############################################################ | |
函数的定义和调用: | |
语法: | |
def 函数名 (参数列表): # 可以没有参数 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for循环是有次数的,不是无限循环的。 | |
while循环: 可以在不阻断的情况下无限循环。 | |
while循环,循环直到表达式为假,表达的十一逻辑表达式,必须返回一个True或False值。 | |
(一定要设置一个结束的参数,不然会一直死循环,把CPU 占满的。) | |
1、 | |
: | |
,而官方还没有相关补丁的漏洞。通俗地讲就是除了漏洞发现者,没有其他的人知道这个漏洞的存在,并且可以有效地加以利用,发起的攻击往往具有很大的突发性与破坏性。 | |
零日攻击或零时差攻击「zero-dayattack」则是指利用这种漏洞进行的攻击,提供该漏洞细节或者利用程序的人通常是该漏洞的发现者。零日漏洞的利用程序对网络安全具有巨大威胁,因此零日漏洞不但是黑客的最爱,掌握多少零日漏洞也成为评价黑客技术水平的一个重要参数。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1、for循环: | |
循环是一个结构,导致一个程序要重复一定次数,条件循环也是如此,当条件变为假False,循环结束。 | |
在python for循环遍历序列,如一个列表或一个字符。 | |
for循环语法: | |
迭代变量:iterating_var(a特ruzi停 窝儿) : 可以取任何数字或者英文,任何值做为迭代变量。 | |
for (迭代变量,可以巡检定义任何) in (序列:可以是一个值、变量、元祖、列表、字典等) |