有没有办法进行这两个库的数据可视化
https://www.worldpresidentsdb.com/list/gender/male/
https://www.worldpresidentsdb.com/list/gender/female/
import requests
from lxml import etree
def main():
base_url = 'https://www.worldpresidentsdb.com'
url = 'https://www.worldpresidentsdb.com/list/gender/male/'
headers = {'user-agent': 'firefox'}
r = requests.get(url, headers=headers)
html = etree.HTML(r.text)
psts = html.xpath('//div[@class="list-group"]//@href')
for pst in psts:
url = f'{base_url}{pst}'
r = requests.get(url, headers=headers)
html = etree.HTML(r.text)
info = html.xpath('//div/p//text()')
print(info)
if __name__ == '__main__':
main()
使用MySQL或者hadoop
页:
[1]