import requests

from bs4 import BeautifulSoup


html = requests.get(url).content

soup = BeautifulSoup(html, 'html.parser')

soup.find_all('mytag') # output: list

soup.find_all(id='myid')

soup.find_all('mytag', { 'class' : 'myclass' })


soup.find('mytag') # output: only one

soup.mytag

'Language > python' 카테고리의 다른 글

[python] ctypes.CFUNCTYPE 사용법  (0) 2017.11.27
[python] converting bytes to ctypes.c_short array  (0) 2017.11.26
[python] get html (urlopen) best way  (0) 2017.11.26
[python] str to bytes  (0) 2017.11.25
[python] json example  (0) 2017.11.25

WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/