python 의 BeautifulSoup 4 의 예

1473 단어 python
시범 용 으로 만 사용 하 다
from bs4 import BeautifulSoup
import urllib

webfile = urllib.urlopen('http://www.baidu.com')
webcontext = webfile.read().decode("UTF-8")

soup = BeautifulSoup(webcontext)

urlInfo = soup.findAll('div',id = 'u')

print urlInfo[0].next.text
print urlInfo[0].next.get('href')

그런데 python 의 보완...방법 을 모색 하고 단점 을 내 려 데 이 터 를 보고 맞 혀 보 세 요.

좋은 웹페이지 즐겨찾기