python2例子(bs4需要pip install,urllib不需要install,是自帶的):
import urllib
from bs4 import BeautifulSoup
resp=urllib.urlopen('網站鏈接')
soup=BeautifulSoup(resp,'html.parser')
python3例子(同樣urllib.request不需要安裝):
import urllib.request
from bs4 import BeautifulSoup
resp=urllib.request.urlopen('網站鏈接')
soup=BeautifulSoup(resp,'html.parser')