LI99999XIA
lzxevol
采纳率71.4%
2021-03-07 09:47

python中提取部分值

已采纳

python中如何将下面result中的的汉字给提取出来

第一个print打印结果为:success:{'data': '[{"bg":"830","ed":"2590","onebest":"绿是阳春烟景,","speaker":"0"},{"bg":"2980","ed":"4190","onebest":"大块文章的底色,","speaker":"0"},{"bg":"4460","ed":"6940","onebest":"4月的林峦更是绿的鲜活,","speaker":"0"},{"bg":"7110","ed":"7810","onebest":"秀妹","speaker":"0"},{"bg":"7990","ed":"9010","onebest":"诗意盎然。","speaker":"0"}]', 'err_no': 0, 'failed': None, 'ok': 0}
 

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • funny123 coagenth 1月前

    用正则表达式提取。假如第一行的数据为d:

    import re

    print(re.findall('\"onebest\":(.*?),',d)),就能提取出结果

    点赞 1 评论 复制链接分享
  • qq_30262201 大数据AI笔记 1月前

    为什么不通过列表和字典的索引访问呢

    点赞 评论 复制链接分享

为你推荐