格式化headers
直接运行即可
代码如下:
import re
headers_str ="""
这块把需要加标点的headers复制进去
"""
pattern = re.compile("^(.*?): (.*)$")
for line in headers_str.splitlines():
print(re.sub(pattern, "\"\\1\": \"\\2\",", line))
总结
本文借鉴于weixin_49265805的博客,原文链接:https://blog.youkuaiyun.com/weixin_49265805/article/details/108103226。