摘要: import requests #构造url url = 'https://api.asilu.com/today' #发送请求 response = requests.get(url) #以text形式返回 page_text = response.text #存储在指定文件中 with open 阅读全文
posted @ 2022-06-13 19:57 淫鬻 阅读(79) 评论(0) 推荐(0) 编辑
摘要: import unittest import requests # 登录请求,断言 class testzylogin(unittest.TestCase): @classmethod def setUpClass(self): # 定义请求地址url,请求参数data,请求结果result sel 阅读全文
posted @ 2022-06-13 19:33 淫鬻 阅读(10) 评论(0) 推荐(0) 编辑
摘要: import unittest import requests import re import json # 第一步:截取usersession,传递到请求参数paras里面 url1 = "http://127.0.0.1:1080/cgi-bin/nav.pl?in=home " sessio 阅读全文
posted @ 2022-06-13 17:38 淫鬻 阅读(67) 评论(0) 推荐(0) 编辑
摘要: 安装教程: https://www.yisu.com/zixun/293100.html 可以直接安装在win10里面(切记webtours和strawberry-perl-5.10.1.0.msi都要安装,不然会报错,之前就是少了strawberry,不能使用) 在winserver2003里面安 阅读全文
posted @ 2022-06-13 17:33 淫鬻 阅读(140) 评论(0) 推荐(0) 编辑
摘要: import requests URL = "https://api.seniverse.com/v3/weather/now.json?" city = '北京' param = { "location": city, "key": "SCYrvkytJze9qyzOh" } # 第一种,使用ge 阅读全文
posted @ 2022-06-13 16:14 淫鬻 阅读(182) 评论(0) 推荐(0) 编辑
摘要: dict与json相互转换之前要导包import json import json d_json = '{"B": 2, "a": 1}'d_dict = json.loads(d_json)d_dict['c'] = 101d_json2 = json.dumps(d_dict)print(d_d 阅读全文
posted @ 2022-06-12 05:35 淫鬻 阅读(874) 评论(0) 推荐(0) 编辑
摘要: bool 判断True或是False bool值为0的有 None, 0, 0.0, 空字符串,空空列表, 空元组, 空集合, 空字典 print(2 and 2) # 2 print(bool(2 and 2)) # True and,or and 有假为假 or 有真为真 and 优先级高于or 阅读全文
posted @ 2022-06-10 00:57 淫鬻 阅读(46) 评论(0) 推荐(0) 编辑
摘要: dict中的get函数 dict.get('值',None) get函数需要有一个变量接受 一般用来判断值是否存在,若不存在则返回None None可以自定义为字符串,数字 dic = {"amd": "yes", "intel": "yyds"} ret = dic.get('amd', None 阅读全文
posted @ 2022-06-10 00:45 淫鬻 阅读(98) 评论(0) 推荐(0) 编辑
摘要: python 列表中的items函数 用来遍历字典中的键值对 使用for i in dict.items时,遍历出来的i是tuple类型 使用for m,n in dict.items时,遍历出来的m,n为str类型 dic = {"amd": "yes", "intel": "yyds"} for 阅读全文
posted @ 2022-06-10 00:41 淫鬻 阅读(36) 评论(0) 推荐(0) 编辑
摘要: 使用脚本,复制start.txt内容,粘贴到end.txt中 from sys import argv from os.path import exists script, from_file, to_file = argv print("Copying from %s to %s." % (fro 阅读全文
posted @ 2022-06-10 00:30 淫鬻 阅读(33) 评论(0) 推荐(0) 编辑