摘要: 1 import unittest 2 import requests 3 import urllib3 4 urllib3.disable_warnings() 5 import warnings # 解决错误 ResourceWarning: Enable tracemalloc to get 阅读全文
posted @ 2021-05-17 16:47 Aliwall 阅读(443) 评论(0) 推荐(0) 编辑
摘要: a = "1" b_name = "小牛牛" # 用 %s 代替一个参数 s 是字符串str的意思. print("my name is %s" %b_name) print("my name is %s and my age is %s years old." % (b_name, a)) # m 阅读全文
posted @ 2021-05-17 16:41 Aliwall 阅读(17) 评论(0) 推荐(0) 编辑
摘要: # 字典传参 token = 'ajkdakkfweids' name = "Jack" body = { 'aaa': '123', 'bbb': '567', 'token': token, #直接用变量代替参数, 注意参数是不需要引号的 'user': 'userid%s' %name # 参 阅读全文
posted @ 2021-05-17 16:40 Aliwall 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 1 # 正则表达式 3 import re 5 a = "https://www.cnblogs.com/levia/p/14629386.html" 7 # 1 知道前后取中间. 取 14629386 8 htmlid = re.findall("/p/(.+?).html", a) 9 prin 阅读全文
posted @ 2021-05-17 16:35 Aliwall 阅读(45) 评论(0) 推荐(0) 编辑
摘要: # 常用 混合模式 mode r+ 读写混合模式. # 默认起始坐标为0,直接写入会覆盖原文件的内容. # 使用 f.seek(0,2) 把光标移到最后再进行写入操作. # f.read()读操作后光标会移到最后. # f.seek(0) # 0 代表从开文件头开始算起. seek(5,0)开头第5 阅读全文
posted @ 2021-05-17 16:33 Aliwall 阅读(612) 评论(0) 推荐(0) 编辑