from bs4 import BeautifulSoup soup = BeautifulSoup(raw) #rawはwebページ読み込みデータ #findAll:該当するタグのオブジェクトをリストで取得 #下記だとクラスがimage-itemsのulを全取得 ul_items = soup.findAll('ul',class_='image-items') #find:該当するタグのオブジェクトを1件取得 a = item.find('a') #id指定だとこんな感じ sample = soup.find(id='template-embed-sample') #属性値の取得 #aタグのリンク先の取得 link = a.attrs['href']