import re
header_str = '''
Accept: image/webp,image/apng,image/*,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cache-Control: no-cache
Connection: keep-alive
Host: store.st.dl.pinyuncloud.com
Pragma: no-cache
Referer: https://store.st.dl.pinyuncloud.com/public/css/v6/store.css?v=fYgBCA4Fq6bj&l=schinese&_cdn=china_pinyuncloud
Sec-Fetch-Dest: image
Sec-Fetch-Mode: no-cors
Sec-Fetch-Site: cross-site
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36
'''
pattern = '^(.*?): (.*)$ '
for line in header_str.splitlines():
print(re.sub(pattern,'\'\\1\': \'\\2\',',line))
网友评论