Advertisement
kasougi

Untitled

Jul 2nd, 2021
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. from bs4 import BeautifulSoup
  2. import requests
  3.  
  4. url = "https://ru.wikipedia.org/wiki/Python"
  5. html = requests.get(url)
  6. soup = BeautifulSoup(html.text, 'html.parser')
  7.  
  8. res = {}
  9. for a in soup.findAll("a"):
  10.     if res.get(a.get("href")):
  11.         res[a.get("href")] += 1
  12.     else:
  13.         res[a.get("href")] = 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement