统计题量

防止不小心删掉然后就贴到这里吧.

import urllib2,time
L=[1154,1155,1156,1157,1158,1159,1160,1161,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1191,1192,1193,1194,1200,1201,1202,1215,1216,1217,1218,1219,1220]
begin=15631030601
f=open(r'f:\\6.txt','w')
while True:
    mmurl="http://121.42.142.123/JudgeOnline/userinfo.php?user="+str(begin)
    up=urllib2.urlopen(mmurl)
    const=up.read()
    end=0
    count=0
    while True:
        head="p(1"
        ph=const.find(head,end+4)
        if ph==-1:
            break
        end=ph
        a=int(const[ph+2:ph+6])
        if a in L:
            count+=1
    print begin,count,'\n'
    f.write(str(begin)+"\t"+str(count)+'\n')
    begin+=1
    if int(begin)==15631030635:
        break
f.close()
time.sleep(2002)

 

posted @ 2016-06-30 19:27  X-POWER  阅读(197)  评论(0编辑  收藏  举报