-1
나는 div35에서 모든 링크를 얻기 위해 class = "pntc-txt"인 코드를 작성하고 <a>
태그 href 속성과 <a href="">Something</a>
사이의 텍스트 이후에 해당 URL과 텍스트를 가져 와서 데이터베이스에 삽입하십시오.<a>에서 URL과 제목을 얻는 방법 beautifulSoup로 태그
import urllib.request
from bs4 import *
sock = urllib.request.urlopen("http://as.com/tag/moto_gp/a/")
htmlSource = sock.read()
sock.close()
soup = BeautifulSoup(htmlSource)
for div in soup.findAll('div', {'class': 'pntc-txt'}):
a = div.findAll('a')
print (a)
여기에 완전히 설명되어 있습니다. https://www.crummy.com/software/BeautifulSoup/bs4/doc/#attributes –