美文网首页
表单数据格式化

表单数据格式化

作者: MkTom | 来源:发表于2020-08-24 01:33 被阅读0次
    
    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))
    
    
    
    
    
    
    

    相关文章

      网友评论

          本文标题:表单数据格式化

          本文链接:https://www.haomeiwen.com/subject/zaimxktx.html