|
目錄 此頁文字之版權條款
Xanga Links LUV_myshan ttl0105 Terry323 yinyin1102 hyuga_nip littlepeach27113 kamkam_123 david_km_lam kakamemories tinyucheung parallel_line Kaimacool KennyKwok2004 chow_dolphin mountainwalker blessing_kamyin0124 po0126 v_vshan emanyiman yoyo_820 Ezekiah skywardling mingchun919 benson0524 wozai ilovego reawilliam scurrychan tigger1029 yeahnina tongdog drronald aheikwok matchshuna patrickleungtk jelly0121 kheinstein moozie GigiloveGod Vivian_Cassandra kahei1129 kencheung628 summer721 CindyxMiffy james_kwok manixmani tsokit icchung ko_cheung201 silvaforest r1ai26n PJLeung makcrystal lokwa CivilHenry adadaping ncwing1987 breakable_audrey christy722 silent927 lomiffy anthony723 e0000000000 joy1118 moussecms |
前往:前五篇純緒
Acer Liquid upgraded from Android 1.6 to 2.1 Screenshot of my Android phone 2010 Jupas 統計小程式 (Python)
import urllib2, re
firstLevel = range(1,22)
secondLevel = range(1,21)
count = dict()
allCsv = ""
countCsv = ""
for i in firstLevel:
for j in secondLevel:
url = "http://web1.jupas.edu.hk/result_pages/" + str(i) + "-" + str(j) + ".htm"
try:
webContent = urllib2.urlopen(url).read()
results = re.findall(r"<td width=150 align=center id=(\d+)>\d+ <a HREF=\"../course_info/(\d+).htm\">\d+</a></td>", webContent)
for result in results:
allCsv += '"' + result[0] + '","' + result[1] + '"\n'
if result[1] in count:
count[result[1]] += 1
else:
count[result[1]] = 1
except:
# dirty handling of files which are not exist
pass
# sort by JUPAS code
keys = count.keys()
keys.sort()
i = 0
length = len(count)
while (i < length):
countCsv += '"' + keys[i] + '","' + str(count[keys[i]]) + '"\n'
i += 1
f = open('all.csv', 'w')
f.write(allCsv)
f.close()
f = open('count.csv', 'w')
f.write(countCsv)
f.close()
count.csv:
永久連結 回應 (1) 2010-7-25 河上鄉 - 塱原 - 上水 本年書展收穫 前往:前五篇純緒 |