标签:cep $2 pre keep ali int mac os 5.0 for
python代码
headers = """
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Connection: keep-alive
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36
"""
hs = headers.split(‘\n‘)
b = [k for k in hs if len(k)]
e = b
f = {(i.split(":")[0], i.split(":", 1)[1].strip()) for i in e}
g = sorted(f)
index = 0
print("{")
for k, v in g:
print(repr(k), repr(v), sep=‘:‘, end=",\n")
print("}")
pycharm直接替换
(.*?):\s(.*)
‘$1‘:‘$2‘,
标签:cep $2 pre keep ali int mac os 5.0 for
原文地址:https://www.cnblogs.com/c-x-a/p/9952447.html