(自用)
#!/usr/bin/env python
# coding:utf-8
# autor:Pai/Part_03
# email:***
# wechat:***
input_headers = """
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/116.0
Accept: application/json, text/plain, */*
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 61
Connection: close
"""
header_lines = input_headers.strip().split('\n')
output_headers = []
for line in header_lines:
header, value = line.split(':', 1)
output_headers.append(f"'{header.strip()}': '{value.strip()}',")
output = '\n'.join(output_headers)[:-1]
print(output)