Python程序设计 15. 爬虫.pptVIP

  • 36
  • 0
  • 约2.31万字
  • 约 90页
  • 2021-10-14 发布于四川
  • 举报
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 用pyppeteer爬取每日上证股票交易信息 #用浏览器自身的查找元素功能获取股票名称和代码 async def getStockCodes(page): codes = [] elements = await page.querySelectorAll(li) #根据tag name找元素 #对应 lia href=/gupiao/600151/航天机电(600151)/a/li for e in elements: a = await e.querySelector(a) #根据tag name找元素 obj = await a.getProperty(text) #还可以 a.getProperty(href) #上面这句不行就改成: obj = await a.getProperty(innerText) text = await obj.jsonValue() #固定写法 if( ( in text and ) in

文档评论(0)

1亿VIP精品文档

相关文档