var shopInfo = "{\"name\":\"承宣\",\"address\":\"校园路香江公寓1号稀土开发区\",\"position\":\"109.855573,40.627727\",\"entId\":1200,\"isFav\":0,\"tel\":\"13500104392\"}";
1
wkdhf233 2015-07-16 02:46:37 +08:00
你这不是JSON吗,干嘛要用正则去匹配。。
|
2
Septembers 2015-07-16 02:52:01 +08:00 1
>>> import re, json
>>> shopInfo = 'var shopInfo = "{\"name\":\"承宣\",\"address\":\"校园路香江公寓1号稀土开发区\",\"position\":\"109.855573,40.627727\",\"entId\":1200,\"isFav\":0,\"tel\":\"13500104392\"}";' >>> re.search('"(.*)";$', shopInfo).group(1) '{"name":"承宣","address":"校园路香江公寓1号稀土开发区","position":"109.855573,40.627727","entId":1200,"isFav":0,"tel":"13500104392"}' >>> json.loads(_) {'entId': 1200, 'address': '校园路香江公寓1号稀土开发区', 'position': '109.855573,40.627727', 'isFav': 0, 'tel': '13500104392', 'name': '承宣'} >>> |
3
Twinkle 2015-07-16 02:58:05 +08:00
JSON.parse(shopInfo)
|
5
leetao102 OP |
6
khan 2015-07-16 12:35:01 +08:00
这不是妥妥的 json 么
|