58 lines
992 B
Python
58 lines
992 B
Python
#!/usr/bin/env python
|
|
|
|
import os,sys
|
|
from pprint import pprint
|
|
from bs4 import BeautifulSoup
|
|
import requests
|
|
|
|
main_url = "https://www.mchk.org.hk/english/list_register/list.php?page=4&ipp=20&type=L"
|
|
req = requests.get(main_url)
|
|
soup = BeautifulSoup(req.text, "html.parser")
|
|
|
|
title = soup.find("h1")
|
|
# print(title.get_text())
|
|
|
|
trs = soup.select("table#Table_5 table tr")
|
|
for tr in trs[2:]:
|
|
tds = tr.select('td')
|
|
|
|
try:
|
|
# pprint(tr)
|
|
|
|
# pprint(tds)
|
|
# print()
|
|
# # reg #
|
|
# pprint(tds[0])
|
|
# # name
|
|
# pprint(tds[1])
|
|
|
|
# # pprint(tds[2])
|
|
# # pprint(tds[3])
|
|
# # pprint(tds[4])
|
|
|
|
# # Nature of qualification
|
|
(tds[5])
|
|
|
|
# # year
|
|
# pprint(tds[7])
|
|
# print()
|
|
# print()
|
|
# print()
|
|
|
|
except Exception as e:
|
|
print('error')
|
|
print(tds[0])
|
|
break
|
|
pass
|
|
|
|
# tds = tr.select('td')
|
|
# pprint(tds)
|
|
# print()
|
|
# print()
|
|
# print()
|
|
# break
|
|
# # print(tds)
|
|
|
|
# pprint('helloworld')
|
|
|