求匹配个python正则

龙上 发布于 2014/01/23 19:04
阅读 2K+
收藏 0
TK.CurrentLotteryType = 4;kkBet.ListIssueInfoForBet = [{"i":"20140123-079"},{"i":"20140123-080"},{"i":"20140123-081"},{"i":"20140123-082"},{"i":"20140123-083"},{"i":"20140123-084"},{"i":"20140123-085"},{"i":"20140123-086"},{"i":"20140123-087"},{"i":"20140123-088"},{"i":"20140123-089"},{"i":"20140123-090"},{"i":"20140123-091"},{"i":"20140123-092"},{"i":"20140123-093"},{"i":"20140123-094"},{"i":"20140123-095"},{"i":"20140123-096"},{"i":"20140123-097"},{"i":"20140123-098"},{"i":"20140123-099"},{"i":"20140123-100"},{"i":"20140123-101"},{"i":"20140123-102"},{"i":"20140123-103"},{"i":"20140123-104"},{"i":"20140123-105"},{"i":"20140123-106"},{"i":"20140123-107"},{"i":"20140123-108"},{"i":"20140123-109"},{"i":"20140123-110"},{"i":"20140123-111"},{"i":"20140123-112"},{"i":"20140123-113"},{"i":"20140123-114"},{"i":"20140123-115"},{"i":"20140123-116"},{"i":"20140123-117"},{"i":"20140123-118"},{"i":"20140123-119"},{"i":"20140123-120"},{"i":"20140124-001"},{"i":"20140124-002"},{"i":"20140124-003"},{"i":"20140124-004"},{"i":"20140124-005"},{"i":"20140124-006"},{"i":"20140124-007"},{"i":"20140124-008"},{"i":"20140124-009"},{"i":"20140124-010"},{"i":"20140124-011"},{"i":"20140124-012"},{"i":"20140124-013"},{"i":"20140124-014"},{"i":"20140124-015"},{"i":"20140124-016"},{"i":"20140124-017"},{"i":"20140124-018"},{"i":"20140124-019"},{"i":"20140124-020"},{"i":"20140124-021"},{"i":"20140124-022"},{"i":"20140124-023"},{"i":"20140124-024"},{"i":"20140124-025"},{"i":"20140124-026"},{"i":"20140124-027"},{"i":"20140124-028"},{"i":"20140124-029"},{"i":"20140124-030"},{"i":"20140124-031"},{"i":"20140124-032"},{"i":"20140124-033"},{"i":"20140124-034"},{"i":"20140124-035"},{"i":"20140124-036"},{"i":"20140124-037"},{"i":"20140124-038"},{"i":"20140124-039"},{"i":"20140124-040"},{"i":"20140124-041"},{"i":"20140124-042"},{"i":"20140124-043"},{"i":"20140124-044"},{"i":"20140124-045"},{"i":"20140124-046"},{"i":"20140124-047"},{"i":"20140124-048"},{"i":"20140124-049"},{"i":"20140124-050"},{"i":"20140124-051"},{"i":"20140124-052"},{"i":"20140124-053"},{"i":"20140124-054"},{"i":"20140124-055"},{"i":"20140124-056"},{"i":"20140124-057"},{"i":"20140124-058"},{"i":"20140124-059"},{"i":"20140124-060"},{"i":"20140124-061"},{"i":"20140124-062"},{"i":"20140124-063"},{"i":"20140124-064"},{"i":"20140124-065"},{"i":"20140124-066"},{"i":"20140124-067"},{"i":"20140124-068"},{"i":"20140124-069"},{"i":"20140124-070"},{"i":"20140124-071"},{"i":"20140124-072"},{"i":"20140124-073"},{"i":"20140124-074"},{"i":"20140124-075"},{"i":"20140124-076"},{"i":"20140124-077"},{"i":"20140124-078"},{"i":"20140124-079"},{"i":"20140124-080"},{"i":"20140124-081"},{"i":"20140124-082"},{"i":"20140124-083"},{"i":"20140124-084"},{"i":"20140124-085"},{"i":"20140124-086"},{"i":"20140124-087"},{"i":"20140124-088"},{"i":"20140124-089"},{"i":"20140124-090"},{"i":"20140124-091"},{"i":"20140124-092"},{"i":"20140124-093"},{"i":"20140124-094"},{"i":"20140124-095"},{"i":"20140124-096"},{"i":"20140124-097"},{"i":"20140124-098"},{"i":"20140124-099"},{"i":"20140124-100"},{"i":"20140124-101"},{"i":"20140124-102"},{"i":"20140124-103"},{"i":"20140124-104"},{"i":"20140124-105"},{"i":"20140124-106"},{"i":"20140124-107"},{"i":"20140124-108"},{"i":"20140124-109"},{"i":"20140124-110"},{"i":"20140124-111"},{"i":"20140124-112"},{"i":"20140124-113"},{"i":"20140124-114"},{"i":"20140124-115"},{"i":"20140124-116"},{"i":"20140124-117"},{"i":"20140124-118"},{"i":"20140124-119"},{"i":"20140124-120"},{"i":"20140125-001"},{"i":"20140125-002"},{"i":"20140125-003"},{"i":"20140125-004"},{"i":"20140125-005"},{"i":"20140125-006"},{"i":"20140125-007"},{"i":"20140125-008"},{"i":"20140125-009"},{"i":"20140125-010"},{"i":"20140125-011"},{"i":"20140125-012"},{"i":"20140125-013"},{"i":"20140125-014"},{"i":"20140125-015"},{"i":"20140125-016"},{"i":"20140125-017"},{"i":"20140125-018"},{"i":"20140125-019"},{"i":"20140125-020"},{"i":"20140125-021"},{"i":"20140125-022"},{"i":"20140125-023"},{"i":"20140125-024"},{"i":"20140125-025"},{"i":"20140125-026"},{"i":"20140125-027"},{"i":"20140125-028"},{"i":"20140125-029"},{"i":"20140125-030"},{"i":"20140125-031"},{"i":"20140125-032"},{"i":"20140125-033"},{"i":"20140125-034"},{"i":"20140125-035"},{"i":"20140125-036"},{"i":"20140125-037"},{"i":"20140125-038"},{"i":"20140125-039"},{"i":"20140125-040"},{"i":"20140125-041"},{"i":"20140125-042"},{"i":"20140125-043"},{"i":"20140125-044"},{"i":"20140125-045"},{"i":"20140125-046"},{"i":"20140125-047"},{"i":"20140125-048"},{"i":"20140125-049"},{"i":"20140125-050"},{"i":"20140125-051"},{"i":"20140125-052"},{"i":"20140125-053"},{"i":"20140125-054"},{"i":"20140125-055"},{"i":"20140125-056"},{"i":"20140125-057"},{"i":"20140125-058"},{"i":"20140125-059"},{"i":"20140125-060"},{"i":"20140125-061"},{"i":"20140125-062"},{"i":"20140125-063"},{"i":"20140125-064"},{"i":"20140125-065"},{"i":"20140125-066"},{"i":"20140125-067"},{"i":"20140125-068"},{"i":"20140125-069"},{"i":"20140125-070"},{"i":"20140125-071"},{"i":"20140125-072"},{"i":"20140125-073"},{"i":"20140125-074"},{"i":"20140125-075"},{"i":"20140125-076"},{"i":"20140125-077"},{"i":"20140125-078"},{"i":"20140125-079"},{"i":"20140125-080"},{"i":"20140125-081"},{"i":"20140125-082"},{"i":"20140125-083"},{"i":"20140125-084"},{"i":"20140125-085"},{"i":"20140125-086"},{"i":"20140125-087"},{"i":"20140125-088"},{"i":"20140125-089"},{"i":"20140125-090"},{"i":"20140125-091"},{"i":"20140125-092"},{"i":"20140125-093"},{"i":"20140125-094"},{"i":"20140125-095"},{"i":"20140125-096"},{"i":"20140125-097"},{"i":"20140125-098"},{"i":"20140125-099"},{"i":"20140125-100"},{"i":"20140125-101"},{"i":"20140125-102"},{"i":"20140125-103"},{"i":"20140125-104"},{"i":"20140125-105"},{"i":"20140125-106"},{"i":"20140125-107"},{"i":"20140125-108"},{"i":"20140125-109"},{"i":"20140125-110"},{"i":"20140125-111"},{"i":"20140125-112"},{"i":"20140125-113"},{"i":"20140125-114"},{"i":"20140125-115"},{"i":"20140125-116"},{"i":"20140125-117"},{"i":"20140125-118"},{"i":"20140125-119"},{"i":"20140125-120"}];var iIssueCount=246821, aryIssue=[{"i":"20140123-001","b":"63816"},{"i":"20140123-002","b":"69338"},{"i":"20140123-003","b":"04790"},{"i":"20140123-004","b":"67154"},{"i":"20140123-005","b":"95185"},{"i":"20140123-006","b":"91614"},{"i":"20140123-007","b":"89253"},{"i":"20140123-008","b":"40869"},{"i":"20140123-009","b":"91967"},{"i":"20140123-010","b":"86081"},{"i":"20140123-011","b":"82963"},{"i":"20140123-012","b":"94444"},{"i":"20140123-013","b":"53675"},{"i":"20140123-014","b":"98151"},{"i":"20140123-015","b":"42070"},{"i":"20140123-016","b":"45554"},{"i":"20140123-017","b":"40741"},{"i":"20140123-018","b":"73670"},{"i":"20140123-019","b":"41870"},{"i":"20140123-020","b":"51021"},{"i":"20140123-021","b":"12428"},{"i":"20140123-022","b":"08090"},{"i":"20140123-023","b":"86164"},{"i":"20140123-024","b":"18634"},{"i":"20140123-025","b":"36143"},{"i":"20140123-026","b":"82431"},{"i":"20140123-027","b":"41299"},{"i":"20140123-028","b":"92474"},{"i":"20140123-029","b":"83419"},{"i":"20140123-030","b":"16274"},{"i":"20140123-031","b":"99446"},{"i":"20140123-032","b":"93974"},{"i":"20140123-033","b":"51374"},{"i":"20140123-034","b":"72762"},{"i":"20140123-035","b":"94318"},{"i":"20140123-036","b":"11830"},{"i":"20140123-037","b":"53237"},{"i":"20140123-038","b":"40451"},{"i":"20140123-039","b":"00274"},{"i":"20140123-040","b":"07940"},{"i":"20140123-041","b":"71382"},{"i":"20140123-042","b":"85114"},{"i":"20140123-043","b":"64603"},{"i":"20140123-044","b":"72459"},{"i":"20140123-045","b":"03615"},{"i":"20140123-046","b":"19603"},{"i":"20140123-047","b":"90814"},{"i":"20140123-048","b":"84047"},{"i":"20140123-049","b":"19691"},{"i":"20140123-050","b":"07083"},{"i":"20140123-051","b":"71557"},{"i":"20140123-052","b":"77358"},{"i":"20140123-053","b":"31652"},{"i":"20140123-054","b":"51795"},{"i":"20140123-055","b":"56745"},{"i":"20140123-056","b":"84553"},{"i":"20140123-057","b":"72447"},{"i":"20140123-058","b":"24446"},{"i":"20140123-059","b":"71745"},{"i":"20140123-060","b":"57137"},{"i":"20140123-061","b":"83307"},{"i":"20140123-062","b":"04755"},{"i":"20140123-063","b":"90525"},{"i":"20140123-064","b":"98787"},{"i":"20140123-065","b":"28609"},{"i":"20140123-066","b":"41354"},{"i":"20140123-067","b":"93229"},{"i":"20140123-068","b":"92961"},{"i":"20140123-069","b":"70476"},{"i":"20140123-070","b":"12419"},{"i":"20140123-071","b":"69889"},{"i":"20140123-072","b":"76999"},{"i":"20140123-073","b":"68017"},{"i":"20140123-074","b":"96708"},{"i":"20140123-075","b":"70358"},{"i":"20140123-076","b":"73734"},{"i":"20140123-077","b":"46965"},{"i":"20140123-078","b":"18803"}];var todayDate=20140123;kkBet.initialize();TK.Video.initialize(null, '60.28.11.19', null, ["[{\"n\":\"20140123-079\",\"t\":\"2014-01-23 19:08:30\"},{\"n\":\"20140123-080\",\"t\":\"2014-01-23 19:18:30\"}]","[{\"n\":\"20140123-079\",\"t\":\"2014-01-23 19:10:00\"},{\"n\":\"20140123-080\",\"t\":\"2014-01-23 19:20:00\"}]","{\"i\":\"20140123-078\",\"b\":\"18803\"}"]);

现在想要匹配出类似这样的数据

{"i":"20140123-078","b":"18803"}

这个正则要这么写呢?

result = re.search('{"i":"(.*?)","b":"(\d+)"}',html)

我这些写不会匹配正确。


完整的代码

# -*- coding: utf-8 -*-
'''
重庆时时彩开奖数据抓取
'''
from pyquery import PyQuery as pq
import re

content = pq(url="http://www.shishicai.cn/cqssc/touzhu/").find('script')
html = pq(content[len(content)-1]).html()
#print(html)
#print(html)
result = re.search('{"i":"(.*?)","b":"(\d+)"}',html)
print(result.group())
conn.close()




加载中
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部