python - 正则表达式求教
PHP中文网
PHP中文网 2017-04-18 10:05:05
0
1
410
{"author":{"user_id":640703312,"user_name":"FOREVERR\u5b89\u5b89","props":null},"content":{"post_id":32334914000,"is_anonym":false,"forum_id":874949,"thread_id":2108034524,"content":"287226800@qq.com    \u8c22\u8c22~<img class=\"BDE_Smiley\" src=\"http:\/\/static.tieba.baidu.com\/tb\/editor\/images\/jd\/j_0043.gif\" width=\"25\" height=\"25\">","post_no":118,"type":"0","comment_num":0,"props":null,"post_index":23,"pb_tpoint":null}}

<type 'str'>


求教如何用正则获取FOREVERR\u5b89\u5b89
PHP中文网
PHP中文网

认证高级PHP讲师

全部回覆(1)
Ty80

基於正規的話 "user_name":"(.[^"]*)" 这样就能提取。
这个字符串是json串,所以用json來解析應該更好

import json
jsonobj = json.loads(jsonstr)
username = jsonobj['author']['user_name'] # 获取user_name内容
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!