|
10鱼币
本帖最后由 python羊 于 2020-9-16 09:31 编辑
想要提取网页中 “净度”对应的 “VS1”,可是一直找到的是空值。
网站:https://www.gia.edu/report-check?reportno=6352100549
代码:
————————————————————
from urllib.request import Request,urlopen
import re
number = '6352100549'
url = 'https://www.gia.edu/report-check?reportno='+ number
headers = {
'User-Agent':'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1500.55 Safari/537.36'
}
request = Request(url,headers=headers)
response = urlopen(request).read()
response = response.decode('utf-8')
clarity = re.findall('<strong class="dynamic" id="CLARITY_GRADE">(.+)</strong>',response)
print(response)
print(clarity)
—————————————————————————————————————————— |
|