我有这个样本数据:
import urllib2
import urllib
import cookielib
url = urllib2.urlopen('https://tandemfs.myschoolapp.com/app#login')
login_url = 'https://tandemfs.myschoolapp.com/app#login'
acc_pwd = {'login':'LogIn','Username':'lukeroberts2022','password':'Enderdude34'}
cj = cookielib.CookieJar() ## add cookies
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders = [('User-agent','Mozilla/5.0 \
(compatible; MSIE 6.0; Windows NT 5.1)')]
data = urllib.urlencode(acc_pwd)
try:
opener.open(login_url,data,10)
print 'log in - success!'
except:
print 'log in - times out!', login_url
print url.geturl()
我想使用正则表达式来捕捉101和孤独3之间的所有内容,这也是一行的开始,到目前为止,我设法找到了这个表达式:
101 ASDFSDAFFA FASDFF TR QWETYUK K PPOWERETY Lpqeor: #
QEREYERP ASJDFL;Z PUTO_LJL;_QWERUOIUO
-- QERT
-- ASPOU3OIUW QW
-- NMBMSJQOET
--
OOPPWERPOQETUIOPYPOIUQEW
2 EWPROIWEURQPWEOIRUQWPEORIUQWEPORIJASDFKLJQPOWIERUAJASKLDFJQPWEOIRUQWPEIORUQWPEROIQWUEPROQIWEURQWPEORIUWPQEOIRUASA;K
QWERPQWOEIURQPWOEIRUPQWOEIRUQWPEORIQWUF;AKLSJDFPQIWEURS;KLADFJPQOWIEURAS;LDKFJQPOWIERUAS;DFKLAJS;DLKFQWEPRIOQUWEPOI
3
101 ASDFSDAFFA FASDFF TR QWETYUK K PPOWERETY Lpqeor: #
QEREYERP ASJDFL;Z PUTO_LJL;_QWERUOIUO
-- QERT
-- ASPO3POIUW QW
-- NMBMSJQOET
--
OOPPWERPOQETUIOPYPOIUQEW
2 EWPROIWEURQPWEOIRUQWPEORIUQWEPORIJASDFKLJQPOWIERUAJASKLDFJQPWEOIRUQWPEIORUQWPEROIQWUEPROQIWEURQWPEORIUWPQEOIRUASA;K
QWERPQWOEIURQPWOEIRUPQWOEIRUQWPEORIQWUF;AKLSJDFPQIWEURS;KLADFJPQOWIEURAS;LDKFJQPOWIERUAS;DFKLAJS;DLKFQWEPRIOQUWEPOI
3
但它在找到角色之间的前三个之后停止,我希望它捕获所有内容,直到它到达3,并且可能重复几次,在该示例中,模式仅出现两次,但可能是这种模式的一千个实例。