python自动化攻击脚本_Python 自动化脚本学习(二)

流程控制

布尔值

temp = True temp = False

比较符号

== != < <= > >=

与或非

and or not

混合布尔的比较

(4<5)and (5<6)

流程控制元素

条件语句 if else

代码块

程序执行

流程描述

if else

if name= John:

print("my name is John");

esle:

print("my name is not John");

elif(其它语言的elseif)

while 循环

temp = 0

while temp <5

print('Hello World')

temp = temp + 1;

break 语句:跳出

continue 语句:跳出本次继续下一次循环

for 循环和range 函数:

for num in range(10)

total = total + num;

print total;

range 的范围和间隔

for num in range(0,10,2)

print(num);//0,2,4,6,8

for num in range(10,-2,-2)

print (num);//10,8,6,4,2,0

导入包

import random

for num in range(3)

print(random.readint(1,10))/打印三次小于10的随机数字

同时导入多个包:

import random,sys,amth,os

结束程序

sys.exit();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值