python学習ノート(二)BeautifulSoup

1403 ワード

 python3.x   BeautifulSoup    ,     
import urllib.request
from bs4 import BeautifulSoup

url = input("Enter-")
html = urllib.request.urlopen(url)
soup = BeautifulSoup(html,'html.parser')

tags = soup('a')
#soup       dict()

for tag in tags:
    print(tag.get('href',None))