from bs4 import BeautifulSoup
            % 首字母大写,显然这是一个类

1. BeautifulSoup 类

HTML 解析类(parser)

r = requests.get(...)
soup = BeautifulSoup(r.text, 'html.parser')

2. 查找和定位方法

Learn Beautiful Soup(3)——使用Beautiful Soup进行查找

  • find(),find_all()
  • find_parent(),find_parents()
  • find_next(),find_all_next()
  • find_next_sibling(),find_next_siblings()
  • find_previous_sibling(),find_previous_siblings()
  • find_previous(),find_all_previous()
posted on 2016-11-05 18:48  未雨愁眸  阅读(119)  评论(0编辑  收藏  举报