V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
U87
V2EX  ›  问与答

Python 中怎么把 unicode 的字符串转换转为列表啊

  •  
  •   U87 · 2018-04-17 10:16:24 +08:00 · 1699 次点击
    这是一个创建于 2443 天前的主题,其中的信息可能已经有所发展或是发生改变。
    如"[{"Id":"0714af88-ba81-4b96-ad8d-50cd97d23b5d","ProjectCode":"20180320 ( GC ) 0003-001","Title":"开江县 2018 年前厢片区财政专项扶贫资金项目、开江县 2018 年后厢片区财政专项扶贫资金项目施工三标段评标报告","CreateDate":"2018-04-16T19:55:32.5","CreateDateTime":null,"CreateDateStr":"2018-04-16","CreateDateAll":"2018-04-16 19:55:32","CityKey":"5980a2f2-4c85-4c5f-be79-97fbbc5fac2f","NoticeType":"C","TableName":"评标公示","Link":"/Info/ProjectDetail/3_0714af88-ba81-4b96-ad8d-50cd97d23b5d.html","TradeName":"A","username":"达州市","province":"四川","businessType":"工程建设","Concern":0},{"Id":"d96e367c-51e5-4c5e-a956-729e67a600cb","ProjectCode":"20180320 ( GC ) 0003-001","Title":"开江县 2018 年前厢片区财政专项扶贫资金项目、开江县 2018 年后厢片区财政专项扶贫资金项目施工四标段评标报告","CreateDate":"2018-04-16T19:54:32.577","CreateDateTime":null,"CreateDateStr":"2018-04-16","CreateDateAll":"2018-04-16 19:54:32","CityKey":"5980a2f2-4c85-4c5f-be79-97fbbc5fac2f","NoticeType":"C","TableName":"评标公示","Link":"/Info/ProjectDetail/3_d96e367c-51e5-4c5e-a956-729e67a600cb.html","TradeName":"A","username":"达州市","province":"四川","businessType":"工程建设","Concern":0},{"Id":"6aea2a48-a9b7-4921-aa39-64bd73470801","ProjectCode":"20180320 ( GC ) 0003-001","Title":"开江县 2018 年前厢片区财政专项扶贫资金项目、开江县 2018 年后厢片区财政专项扶贫资金项目施工五标段评标报告","CreateDate":"2018-04-16T19:47:02.5","CreateDateTime":null,"CreateDateStr":"2018-04-16","CreateDateAll":"2018-04-16 19:47:02","CityKey":"5980a2f2-4c85-4c5f-be79-97fbbc5fac2f","NoticeType":"C","TableName":"评标公示","Link":"/Info/ProjectDetail/3_6aea2a48-a9b7-4921-aa39-64bd73470801.html","TradeName":"A","username":"达州市","province":"四川","businessType":"工程建设","Concern":0},{"Id":"283c0ac3-4c80-4ae9-9867-896131aae5b2","ProjectCode":"20180320 ( GC ) 0003-001","Title":"开江县 2018 年前厢片区财政专项扶贫资金项目、开江县 2018 年后厢片区财政专项扶贫资金项目施工七标段评标报告","CreateDate":"2018-04-16T19:34:02.61","CreateDateTime":null,"CreateDateStr":"2018-04-16","CreateDateAll":"2018-04-16 19:34:02","CityKey":"5980a2f2-4c85-4c5f-be79-97fbbc5fac2f","NoticeType":"C","TableName":"评标公示","Link":"/Info/ProjectDetail/3_283c0ac3-4c80-4ae9-9867-896131aae5b2.html","TradeName":"A","username":"达州市","province":"四川","businessType":"工程建设","Concern":0},{"Id":"1a01365d-8d5a-45b0-8fca-2fa59d4c7ce6","ProjectCode":"20180320 ( GC ) 0003-001","Title":"开江县 2018 年前厢片区财政专项扶贫资金项目、开江县 2018 年后厢片区财政专项扶贫资金项目施工九标段评标报告","CreateDate":"2018-04-16T19:30:32.64","CreateDateTime":null,"CreateDateStr":"2018-04-16","CreateDateAll":"2018-04-16 19:30:32","CityKey":"5980a2f2-4c85-4c5f-be79-97fbbc5fac2f","NoticeType":"C","TableName":"评标公示","Link":"/Info/ProjectDetail/3_1a01365d-8d5a-45b0-8fca-2fa59d4c7ce6.html","TradeName":"A","username":"达州市","province":"四川","businessType":"工程建设","Concern":0},{"Id":"3e1ce41f-5e34-436f-af1e-5ab2aca6dd67","ProjectCode":"20180320 ( GC ) 0003-001","Title":"开江县 2018 年前厢片区财政专项扶贫资金项目、开江县 2018 年后厢片区财政专项扶贫资金项目施工八标段评标报告","CreateDate":"2018-04-16T19:26:32.657","CreateDateTime":null,"CreateDateStr":"2018-04-16","CreateDateAll":"2018-04-16 19:26:32","CityKey":"5980a2f2-4c85-4c5f-be79-97fbbc5fac2f","NoticeType":"C","TableName":"评标公示","Link":"/Info/ProjectDetail/3_3e1ce41f-5e34-436f-af1e-5ab2aca6dd67.html","TradeName":"A","username":"达州市","province":"四川","businessType":"工程建设","Concern":0},{"Id":"502543c1-57c3-47e8-86b2-f10dd37a48fa","ProjectCode":"20180109 ( GC ) 0002-001","Title":"大竹县政务服务中心、公共资源交易服务中心、惠民帮扶中心及群团组织服务中心业务用房建设项目施工一标段中标公示","CreateDate":"2018-04-16T19:22:35.733","CreateDateTime":null,"CreateDateStr":"2018-04-16","CreateDateAll":"2018-04-16 19:22:35","CityKey":"5980a2f2-4c85-4c5f-be79-97fbbc5fac2f","NoticeType":"D","TableName":"中标公告","Link":"/Info/ProjectDetail/5_502543c1-57c3-47e8-86b2-f10dd37a48fa.html","TradeName":"A","username":"达州市","province":"四川","businessType":"工程建设","Concern":0},{"Id":"a2bd7000-4b34-4e44-ac98-ff57f1119642","ProjectCode":"RSGJZB20180120000000","Title":"仁寿县黑龙滩镇等两所学校扩建工程 /标段开标记录表","CreateDate":"2018-04-16T19:02:17.36","CreateDateTime":null,"CreateDateStr":"2018-04-16","CreateDateAll":"2018-04-16 19:02:17","CityKey":"f9668c0a-f61c-47e6-9586-9275e3b226e0","NoticeType":"B","TableName":"开标记录","Link":"/Info/ProjectDetail/2_a2bd7000-4b34-4e44-ac98-ff57f1119642.html","TradeName":"A","username":"眉山市","province":"四川","businessType":"工程建设","Concern":0},{"Id":"c802eb39-0f54-4bf0-917a-1c7e0f6d5871","ProjectCode":"MSGJZB20180180000000","Title":"眉山机械产业园区 1#污水处理厂 /标段开标记录表","CreateDate":"2018-04-16T19:02:16.86","CreateDateTime":null,"CreateDateStr":"2018-04-16","CreateDateAll":"2018-04-16 19:02:16","CityKey":"f9668c0a-f61c-47e6-9586-9275e3b226e0","NoticeType":"B","TableName":"开标记录","Link":"/Info/ProjectDetail/2_c802eb39-0f54-4bf0-917a-1c7e0f6d5871.html","TradeName":"A","username":"眉山市","province":"四川","businessType":"工程建设","Concern":0},{"Id":"d05417a0-46d0-4223-8caf-96160bd7d6d2","ProjectCode":"RSGJZB20180130000000","Title":"仁寿县富加镇等五所学校扩建工程 /标段开标记录表","CreateDate":"2018-04-16T19:02:16.577","CreateDateTime":null,"CreateDateStr":"2018-04-16","CreateDateAll":"2018-04-16 19:02:16","CityKey":"f9668c0a-f61c-47e6-9586-9275e3b226e0","NoticeType":"B","TableName":"开标记录","Link":"/Info/ProjectDetail/2_d05417a0-46d0-4223-8caf-96160bd7d6d2.html","TradeName":"A","username":"眉山市","province":"四川","businessType":"工程建设","Concern":0}]"
    10 条回复    2018-04-17 16:22:20 +08:00
    fuergaosi
        1
    fuergaosi  
       2018-04-17 10:20:33 +08:00 via iPhone
    eval ()
    U87
        2
    U87  
    OP
       2018-04-17 10:23:20 +08:00
    eval ()不行的,后续会有报错:NameError: name ‘ null ’ is not defined
    prolic
        3
    prolic  
       2018-04-17 10:26:19 +08:00
    这不是个 json 么,json.loads
    infun
        4
    infun  
       2018-04-17 10:29:24 +08:00
    import simplejson as json
    & eval()
    princelai
        5
    princelai  
       2018-04-17 10:29:34 +08:00
    你这格式不标准,有 null 才没法用 eval,json.loads 是可行的
    U87
        6
    U87  
    OP
       2018-04-17 10:38:42 +08:00
    您发的 JSON 是一个字符串,而不是对象,您需要转成 JSON 对象么? 我在 json 验证网站这个校验时,不是 json 啊。。,虽然也可以 json.loads 好奇怪。。
    DT27
        7
    DT27  
       2018-04-17 10:42:00 +08:00
    @U87 #6 你校验是不是连最外面一对引号复制了。。。
    U87
        8
    U87  
    OP
       2018-04-17 14:40:04 +08:00
    @DT27 是的,就是要去除引号,不然不好取值。。。
    Sylv
        9
    Sylv  
       2018-04-17 15:36:02 +08:00 via iPhone
    json.loads 了解一下。
    Qzier
        10
    Qzier  
       2018-04-17 16:22:20 +08:00 via iPhone
    非标准 json 可以试试 demjson 模块
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1035 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:42 · PVG 03:42 · LAX 11:42 · JFK 14:42
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.