#!/usr/bin/env python
# coding=utf-8
import urllib
import time
import urllib.request
import os
def getPhoto(num):
response = urllib.request.urlopen('
http://example.com/getuserphoto.jsp?userid=20135%s'%num)
thePage = response.read()
f = open(('./photo1/%s.jpg'%(num)),'wb')
f.write(thePage)
f.close()
stunum = 1
while(stunum <= 9999):
if stunum < 10:
stu_num = '000%d'%(stunum)
elif stunum < 100:
stu_num = '00%d'%(stunum)
elif stunum < 1000:
stu_num = '0%d'%(stunum)
else:
stu_num = stunum
getPhoto(stu_num)
#time.sleep(1)
stunum = stunum + 1