摘要: #test_sample.py import requests def test_api_1(): """测试第一个接口,检查状态码是否为 200""" response = requests.get('https://jsonplaceholder.typicode.com/todos/1') a 阅读全文
posted @ 2025-02-12 14:33 wxy90 阅读(124) 评论(0) 推荐(0)
摘要: #md5,解密不了import hashlibs="wendy"print(s.encode())#bytes,把字符串变成字节类型m=hashlib.md5(s.encode())result=m.hexdigest()print(result)#加盐salt='234SSSS_@###'afte 阅读全文
posted @ 2021-05-28 02:47 wxy90 阅读(59) 评论(0) 推荐(0)
摘要: 1、random.random random.random()用于生成一个0到1的随机符小数: 0 <= n < 1.0 random.random() 2、random.uniform random.uniform的函数原型为:random.uniform(a, b),用于生成一个指定范围内的随机 阅读全文
posted @ 2021-05-18 23:47 wxy90 阅读(62) 评论(0) 推荐(0)
摘要: #函数自己调用自己就是递归def test(): print("递归") test()test()def test1(): num=input("请输入").strip() if num%2==0: return num test1()test1() def is_float(s): s=str(s 阅读全文
posted @ 2021-05-12 00:12 wxy90 阅读(60) 评论(0) 推荐(0)
摘要: #解包,数组,元祖,字符串都可以,只要有下标msg = 'admin,123'username1=msg.split(',')[0]pwd1=msg.split(',')[1]# 可以合并成一行代码username,pwd=msg.split(',')l=[1,2,3]f,k,g=ll2=(1,2, 阅读全文
posted @ 2021-05-12 00:09 wxy90 阅读(52) 评论(0) 推荐(0)
摘要: #r 只能读,打开不存在的文件会报错#W 只能写,文件不存在,会新建一个,文件存在会覆盖之前的内容#a 文件不存在会新建,能写,不会覆盖之前的内容,不能读nums=['1','2',]nums2=[]f= open('a.txt','w',encoding='utf-8')#f.write("XX" 阅读全文
posted @ 2021-04-25 21:44 wxy90 阅读(45) 评论(0) 推荐(0)
摘要: 1. 集合天生是可以去重的,是无序的 2. 定义集合: 定义一个空的集合,要用set,s2=set() 3. 集合和列表之间转换 l=[1,2,3,2,3,1,4,5,2]print(list(set(l))) 4. 集合的增删 s ={1,2,3,4,3}s.add(5)#增加元素 s.updat 阅读全文
posted @ 2021-04-25 21:41 wxy90 阅读(57) 评论(0) 推荐(0)
摘要: #三元表达式age =12age1=''age1='成年' if age >= 17 else '未成年'print(age1)#列表生成l= list(range(1,10))l3 = [i for i in l if i%2==0]print(l3)#变量交换a=1b=2#第一种a,b=b,ap 阅读全文
posted @ 2021-04-25 21:33 wxy90 阅读(68) 评论(0) 推荐(0)