首页 > 其他 > 详细

统计题量

时间:2016-06-30 19:57:25      阅读:153      评论:0      收藏:0      [点我收藏+]

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

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(rf:\\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)

 

统计题量

原文:http://www.cnblogs.com/A-FM/p/5630997.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!