import re
pattern = '^(.*?): (.*)$'
headers_str = """
cc: 1
ck: 1
cl: 24-bit
ds: 1536x864
vl: 216
ep: 首页*web端总共query数
et: 4
ja: 0
ln: zh-cn
lo: 0
lt: 1589799548
rnd: 1205417506
si: 64ecd82404c51e03dc91cb9e8c025574
su: https://fanyi.baidu.com/
"""
for line in headers_str.splitlines():
print(re.sub(pattern, '\'\\1\': \'\\2\',', line))