forked from yhangf/PythonCrawler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudent_img.py
More file actions
26 lines (24 loc) · 916 Bytes
/
Copy pathstudent_img.py
File metadata and controls
26 lines (24 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import requests
url = ''
banji = []
zhuanye = []
for a in range(10):
for b in range(10):
banji.append(str(a) + '0' + str(b))
for c in range(10):
zhuanye.append('20' + str(c))
for year in range(2011, 2015):
for xh in zhuanye:
for nj in banji:
for i in range(1, 35):
if i < 10:
xuehao = str(year) + str(xh) + str(nj) + '0' + str(i)
student_url = url + xuehao
with open('E:/student_img/%s.jpeg' % xuehao, 'wb') as file:
file.write(requests.get(student_url).content)
else:
xuehao = str(year) + str(xh) + str(nj) + str(i)
student_url = url + xuehao
with open('E:/student_img/%s.jpeg' % xuehao, 'wb') as file:
file.write(requests.get(student_url).content)
print('OK!')