码迷,mamicode.com
首页 > 其他好文 > 详细

统计题量

时间:2016-06-30 19:58:33      阅读:189      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!