第二周 2(信息标记与提取)

 

标记后的信息可形成信息组织结构,增加了信息维度
标记的结构与信息一样具有重要价值
标记后的信息可用于通信、存储或展示
标记后的信息更利于程序理解和运用

 

 

 

 

 

 

信息标记的三种形式:

XML
JSON
YAML

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 基于bs4库的HTML内容查找方法

from bs4 import BeautifulSoup
import requests

r = requests.get("http://python123.io/ws/demo.html")
demo = r.text

soup = BeautifulSoup(demo, 'html.parser')
soup.find_all('a')
soup.find_all(['a', 'b'])
for tag in soup.find_all(True):
    print(tag.name)

  

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

posted @ 2018-08-23 15:32  菜鸟key  阅读(274)  评论(0编辑  收藏  举报