--维持会话--
session = request.Session()
)--阻塞与非阻塞--
--IP池--
--逻辑、分组、引用--
引用捕获到的东西
示例:
# --- coding: utf-8 ---d
import re
# 引用5次 分组1捕获到的结果
pattern=‘135(\d)\\1{5}(.-)‘
string=‘13588888865‘
r=re.search(pattern,string)
print(r)
D:\Python\Python3.7\python3.exe "E:/Other Document/Py_Project/Python3_proj/Pachong/逻辑分组引用.py"
<re.Match object; span=(0, 11), match=‘13588888865‘>
Process finished with exit code 0
re.search(pattern、string、flages)
只匹配一次re.match(pattern、string、flages)
匹配字符串开头,并且只匹配一次re.findall(pattern、string、flages)
匹配所有的结果,返回结果为列表形式,若没有匹配到,则返回空列表 注意:反转列表:[::-1]re.finditer(pattern、string、flages)
和findall()
相似,只是结果返回结果是个迭代器iterator,需要遍历re.split(pattern、string,maxsplit,flages)
, maxsplit
:要切割的次数,默认0,表示全部切割re.I
-->无视大小写 大小写都可以匹配re.S
-->使“.”能够匹配换行符string=‘asd3fasdfJava8hih‘
pattern=‘df(.-?)8‘ #匹配以df开头,以8结尾的里面额所有的内容(除了换行符),并提取出来
result=re.findall(pattern,string)
print(result)
D:\Python\Python3.7\python3.exe "E:/Other Document/Py_Project/Python3_proj/Pachong/逻辑分组引用.py"
Java
Process finished with exit code 0
自动化测试工具
类似--按键精灵--,反复执行编写的命令
模拟浏览器访问网站
操作浏览器,浏览器会对(JS、Ajax、jQuery)进行渲染,选然后的数据可以用Selenium直接获取
find_element_by_xpath():driver.find_element_by_xpath()
原文:https://www.cnblogs.com/Hiraly/p/15153500.html