使用re模块中的findall函数,其中【.*?】也可以为【.+?】。
res = re.findall(r'前面的子串(.*?)后面的子串',输入的字符串)[0] |
例1:搜索以【https://】开头,以【/html/】结尾的中间的内容
import re |
例2:搜索以【A】开头,以【B】结尾的中间的内容
import re |
使用re模块中的findall函数,其中【.*?】也可以为【.+?】。
res = re.findall(r'前面的子串(.*?)后面的子串',输入的字符串)[0] |
例1:搜索以【https://】开头,以【/html/】结尾的中间的内容
import re |
例2:搜索以【A】开头,以【B】结尾的中间的内容
import re |