摘要: kw= {'num1': 2, 'num3': 5}7kw= (2, 5)7kw= (2, 5)7kw= (2, 5)7 阅读全文
posted @ 2019-07-24 20:15 心痛是尾调 阅读(639) 评论(0) 推荐(0) 编辑
摘要: ['bob', 'about', 'Zoo', 'Credit']忽略字母大小写,进行名字排序[('adam', 92), ('bob', 75), ('cart', 66), ('Eisa', 88)]按成绩从低到高排序:[('cart', 66), ('bob', 75), ('Eisa', 8 阅读全文
posted @ 2019-07-24 16:51 心痛是尾调 阅读(340) 评论(0) 推荐(0) 编辑
摘要: reduce()的使用方法形如reduce(function, iterable[, initializer]),它的形式和map()函数一样。不过参数f(x)必须有两个参数,initializer是可选的。 请看实例:(注意在Python3中reduce不再是内置函数,而是集成到了functool 阅读全文
posted @ 2019-07-24 14:00 心痛是尾调 阅读(244) 评论(0) 推荐(0) 编辑
摘要: import re ''' 取值postid,左边界"postid=",右边界"&" ''' url="http://wwww.baidu.com/aspx?postid=6232&actiontip='保存成功'" postid=re.findall(r"postid=(.*?)&",url)[0] print(postid) def findall_data(data,LB="",RB="... 阅读全文
posted @ 2019-07-15 23:19 心痛是尾调 阅读(1198) 评论(0) 推荐(0) 编辑
摘要: from locust import HttpLocust,TaskSet,task ''' 点击STOP,会停止测试,并调用所有当前执行的TaskSet的on_stop,但不会调用teardown函数 ctrl +c,表示停止locust运行,此时会调用TaskSet teardown # 停止locust运行时执行,Locust teardown # 停止locust运行时执行,(而不会... 阅读全文
posted @ 2019-07-15 12:45 心痛是尾调 阅读(1873) 评论(0) 推荐(0) 编辑
摘要: 为TaskSet声明任务的典型方法是使用task装饰器。该min_wait和MAX_WAIT属性也可以在使用taskset类中重写。 使用@task装饰器来声明任务是一种方便,通常是最好的方法。但是,也可以通过设置tasks属性来定义TaskSet的任务 (使用@task装饰器实际上只会填充task 阅读全文
posted @ 2019-07-14 20:52 心痛是尾调 阅读(1737) 评论(0) 推荐(0) 编辑
摘要: import random from random import randint ''' random.randint()随机生一个整数int类型,可以指定这个整数的范围,同样有上限和下限值,python random.randint。 random.choice()可以从任何序列,比如list列表中,选取一个随机的元素返回,可以用于字符串、列表、元组等。 random.sample()可以... 阅读全文
posted @ 2019-07-11 23:11 心痛是尾调 阅读(27140) 评论(0) 推荐(0) 编辑
摘要: for x in range(1,4): for o in range(0,x-1): print('*',end='') pass pass print('*') print('\n')print("正方形")for c in range(1,4): for b in range(2): prin 阅读全文
posted @ 2018-08-16 23:48 心痛是尾调 阅读(772) 评论(1) 推荐(0) 编辑
摘要: #字符串拼接#str.join(元组、列表、字典、字符串) 之后生成的只能是字符串。str = "-";seq = ("a", "b", "c"); # 字符串序列sqr=['a','b','c','sss']#listssr=str.join(sqr)print('='.join(ssr)) pr 阅读全文
posted @ 2018-08-16 23:43 心痛是尾调 阅读(267) 评论(0) 推荐(0) 编辑
摘要: <!DOCTYPE html><html><head><meta charset="utf-8"><title>菜鸟教程</title><style>nav{height:35px;width:1200px;}ul{ list-style-type:none; margin:0; padding:0 阅读全文
posted @ 2016-09-07 09:34 心痛是尾调 阅读(114) 评论(0) 推荐(0) 编辑