#coding=utf-8
import re
from urllib.parse import parse_qsl
'''
公式:
知道前后取中間,遇到字符加轉義\;
取到末尾的后面補一個$
'''
#利用正則表達式取值
#第一種:取中間的值,用(.+?),知道前后取中間,遇到字符加轉義\
a = 'value="abcbdbxbxbbb"'
r=re.findall('value="(.+?)"',a)
print (r[0])
打印的結果:abcbdbxbxbbb
#第二種,取到末尾的后面補一個$,取b=hello
a = "https://xxx.com/?a=helloworld&b=hello"
r=re.findall('ld\&(.+?)$',a)
print (r[0])
打印的結果:b=hello
#我要取a=helloworld
a=re.findall('com/\?(.+?)\&',a)
print (a[0])
打印的結果:a=helloworld