生活随笔
收集整理的這篇文章主要介紹了
三、Beautiful Soup解析库
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一、Beautiful Soup介紹與安裝
1,Beautiful Soup介紹
答:Beautiful Soup是一個可以從HTML或XML文件中提取數據的Python庫
2,Beautiful Soup安裝
答:安裝Beautiful Soup 4:pip install bs4
安裝lxml:pip install lxml
二、Beautiful Soup對象介紹與創建
1,Beautiful Soup對象介紹
答:Beautiful Soup對象代表要解析整個文檔樹,支持遍歷文檔樹和搜索文檔樹中描述的大部分的方法。
2,Beautiful Soup對象創建
答:
導入模塊:from bs4 import BeautifulSoup創建Beautiful Soup對象:soup = BeautifulSoup('html文檔','lxml')
from bs4
import BeautifulSoup
soup
= BeautifulSoup
('<html>data</html>','lxml')
print(soup
)
3,Beautiful Soup對象的find方法
find方法的作用:搜索文檔樹
find(self,name=None,attrs={},recursive=True,text=None,**kwargs)
參數:
name:標簽名
attrs:屬性字典
recursive:是否遞歸循環查找
text:根據文本內容查找
返回:
查找到的第一個元素對象
根據標簽名查找:soup.find(‘a’)
根據屬性查找:soup.find(id=‘2’)、soup.find(attrs={‘id’:‘2’})
根據文本內容查找:soup.find(text=‘three’)
①根據標簽名查找
獲取下面文檔中的title標簽和a標簽
文檔內容如下:
<html
> <head
><title
>百度一下,你就知道
</title
></head
><body
><p
class="title"><b
>beyondyanyu
</b
></p
><p
class="beyond"> Epiphany
<a href
=https
://blog
.csdn
.net
/qq_41264055?spm
=1011.2124.3001.5343 id="1" class=beyond
>one
</a
><a href
=https
://blog
.csdn
.net
/qq_41264055?spm
=1011.2124.3001.5343 id="2" class=beyond
>two
</a
><a href
=https
://blog
.csdn
.net
/qq_41264055?spm
=1011.2124.3001.5343 id="3" class=beyond
>three
</a
>humour
</p
></body
>
</html
>
from bs4
import BeautifulSoup
html
= '''
<html> <head><title>百度一下,你就知道</title></head><body><p class="title"><b>beyondyanyu</b></p><p class="beyond"> Epiphany<a href=https://blog.csdn.net/qq_41264055?spm=1011.2124.3001.5343 id="1" class=beyond>one</a><a href=https://blog.csdn.net/qq_41264055?spm=1011.2124.3001.5343 id="2" class=beyond>two</a><a href=https://blog.csdn.net/qq_41264055?spm=1011.2124.3001.5343 id="3" class=beyond>three</a>humour</p></body>
</html>
'''
soup
= BeautifulSoup
(html
,'lxml')
title
= soup
.find
('title')
print(title
)
a
= soup
.find
('a')
print(a
)
a_all
= soup
.find_all
('a')
print(a_all
)
②根據屬性查找
獲取下面文檔中的id為2的標簽
文檔內容如下:
<html
> <head
><title
>百度一下,你就知道
</title
></head
><body
><p
class="title"><b
>beyondyanyu
</b
></p
><p
class="beyond"> Epiphany
<a href
=https
://blog
.csdn
.net
/qq_41264055?spm
=1011.2124.3001.5343 id="1" class=beyond
>one
</a
><a href
=https
://blog
.csdn
.net
/qq_41264055?spm
=1011.2124.3001.5343 id="2" class=beyond
>two
</a
><a href
=https
://blog
.csdn
.net
/qq_41264055?spm
=1011.2124.3001.5343 id="3" class=beyond
>three
</a
>humour
</p
></body
>
</html
>
from bs4
import BeautifulSoup
html
= '''
<html> <head><title>百度一下,你就知道</title></head><body><p class="title"><b>beyondyanyu</b></p><p class="beyond"><a href=https://blog.csdn.net/qq_41264055?spm=1011.2124.3001.5343 id="1" class=beyond>one</a><a href=https://blog.csdn.net/qq_41264055?spm=1011.2124.3001.5343 id="2" class=beyond>two</a><a href=https://blog.csdn.net/qq_41264055?spm=1011.2124.3001.5343 id="3" class=beyond>three</a></p></body>
</html>
'''
soup
= BeautifulSoup
(html
,'lxml')
two
= soup
.find
(id='2')
print(two
)
two
= soup
.find
(attrs
={'id':'2'})
print(two
)
③根據文本查找
獲取下面文檔中文本為three的標簽文本
文檔內容如下:
<html
> <head
><title
>百度一下,你就知道
</title
></head
><body
><p
class="title"><b
>beyondyanyu
</b
></p
><p
class="beyond"> Epiphany
<a href
=https
://blog
.csdn
.net
/qq_41264055?spm
=1011.2124.3001.5343 id="1" class=beyond
>one
</a
><a href
=https
://blog
.csdn
.net
/qq_41264055?spm
=1011.2124.3001.5343 id="2" class=beyond
>two
</a
><a href
=https
://blog
.csdn
.net
/qq_41264055?spm
=1011.2124.3001.5343 id="3" class=beyond
>three
</a
>humour
</p
></body
>
</html
>
from bs4
import BeautifulSoup
html
= '''
<html> <head><title>百度一下,你就知道</title></head><body><p class="title"><b>beyondyanyu</b></p><p class="beyond"><a href=https://blog.csdn.net/qq_41264055?spm=1011.2124.3001.5343 id="1" class=beyond>one</a><a href=https://blog.csdn.net/qq_41264055?spm=1011.2124.3001.5343 id="2" class=beyond>two</a><a href=https://blog.csdn.net/qq_41264055?spm=1011.2124.3001.5343 id="3" class=beyond>three</a></p></body>
</html>
'''
soup
= BeautifulSoup
(html
,'lxml')
text
= soup
.find
(text
='three')
print(text
)
4,Beautiful Soup對象中的Tag對象
Tag對象介紹:Tag對象對應于原始文檔中的XML或HTML標簽
Tag有很多方法和屬性,可以用于遍歷文檔樹和搜索文檔樹以及獲取標簽內容
Tag對象常見的屬性
name:獲取標簽名稱
attrs:獲取標簽所有屬性的鍵和值
text:獲取標簽的文本字符串
from bs4
import BeautifulSoup
html
= '''
<html> <head><title>百度一下,你就知道</title></head><body><p class="title"><b>beyondyanyu</b></p><p class="beyond"><a href=https://blog.csdn.net/qq_41264055?spm=1011.2124.3001.5343 id="1" class=beyond>one</a><a href=https://blog.csdn.net/qq_41264055?spm=1011.2124.3001.5343 id="2" class=beyond>two</a><a href=https://blog.csdn.net/qq_41264055?spm=1011.2124.3001.5343 id="3" class=beyond>three</a></p></body>
</html>
'''
soup
= BeautifulSoup
(html
,'lxml')
title
= soup
.find
('title')
a
= soup
.find
('a')print(type(a
))
print("標簽名:",a
.name
)
print("標簽所有屬性",a
.attrs
)
print("標簽文本內容",a
.text
)
三、從疫情首頁提取全國最新的疫情數據
當然,數據來源仍然是丁香園新型冠狀病毒肺炎疫情實時動態首頁
url:https://ncov.dxy.cn/ncovh5/view/pneumonia
import requests
from bs4
import BeautifulSoup
response
= requests
.get
('https://ncov.dxy.cn/ncovh5/view/pneumonia')
home_page
= response
.content
.decode
()
'''
<!DOCTYPE html><html lang="zh-cn" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" style="filter: none;"><head><link rel="stylesheet" href="//assets.dxycdn.com/gitrepo/ncov-mobile/dist/umi.bundle.css?t=1645425725691"><meta charset="utf-8"><meta content="width=device-width,initial-scale=1,user-scalable=0,viewport-fit=cover" name="viewport"><meta content="#000000" name="theme-color"><title></title><script>window.routerBase = "/ncovh5/view";</script>
<script charset="utf-8" src="//assets.dxycdn.com/gitrepo/ncov-mobile/dist/vendors~p__ECommerce~p__Pneumonia~p__Pneumonia__area~p__Pneumonia__area__index_en~p__Pneumonia__dete~e354351c.async.f15190c5.js"></script><script charset="utf-8" src="//assets.dxycdn.com/gitrepo/ncov-mobile/dist/vendors~p__Pneumonia~p__Pneumonia__area~p__Pneumonia__policy~p__Pneumonia__risk-zone~p__Pneumonia__rumor-list.async.035b6a59.js"></script><link rel="stylesheet" type="text/css" href="//assets.dxycdn.com/gitrepo/ncov-mobile/dist/vendors~p__ECommerce~p__Pneumonia~p__Pneumonia__area~p__Pneumonia__hotspot~p__Pneumonia__index_en.async.1eec8c54.css"><script charset="utf-8" src="//assets.dxycdn.com/gitrepo/ncov-mobile/dist/vendors~p__ECommerce~p__Pneumonia~p__Pneumonia__area~p__Pneumonia__hotspot~p__Pneumonia__index_en.async.61a0218b.js"></script><script charset="utf-8" src="//assets.dxycdn.com/gitrepo/ncov-mobile/dist/vendors~p__Pneumonia~p__Pneumonia__area__index_en~p__Pneumonia__index_en.async.72f0956a.js"></script><link rel="stylesheet" type="text/css" href="//assets.dxycdn.com/gitrepo/ncov-mobile/dist/p__Pneumonia.async.5cef6c52.css"><script charset="utf-8" src="//assets.dxycdn.com/gitrepo/ncov-mobile/dist/p__Pneumonia.async.bc83130c.js"></script><meta name="description" content="丁香園、丁香醫生整合各權威渠道發布的官方數據,通過疫情地圖直觀展示,持續更新最新的新型冠狀病毒肺炎的實時疫情動態。"><meta name="keywords" content="最新疫情、實時疫情、疫情地圖、疫情、丁香園"><meta name="baidu-site-verification" content="IL1HU7F7Vj"></head>
<body><script id="getAreaStat">try { window.getAreaStat = [{"provinceName":"香港","provinceShortName":"香港","currentConfirmedCount":5990,"confirmedCount":22468,"suspectedCount":181,"curedCount":16190,"deadCount":288,"comment":"疑似 1 例","locationId":810000,"statisticsData":"https://file1.dxycdn.com/2020/0223/331/3398299755968040033-135.json","highDangerCount":0,"midDangerCount":0,"detectOrgCount":0,"vaccinationOrgCount":0,"cities":[],"dangerAreas":[]},{"provinceName":"臺灣","provinceShortName":"臺灣","currentConfirmedCount":5413,"confirmedCount":20007,"suspectedCount":485,"curedCount":13742,"deadCount":852,"comment":"","locationId":710000,"statisticsData":"https://file1.dxycdn.com/2020/0223/045/3398299749526003760-135.json","highDangerCount":0,"midDangerCount":0,"detectOrgCount":0,"vaccinationOrgCount":0,"cities":[],"dangerAreas":[]},{"provinceName":"浙江省","provinceShortName":"浙江","currentConfirmedCount":388,"confirmedCount":2255,"suspectedCount":68,"curedCount":1866,"deadCount":1,"comment":"2月10日通報核減的12例在浙江省治愈的外省病例,根據國家最新要求重新納入累計病例。","locationId":330000,"statisticsData":"https://file1.dxycdn.com/2020/0223/537/3398299755968455045-135.json","highDangerCount":0,"midDangerCount":0,"detectOrgCount":519,"vaccinationOrgCount":217,"cities":[{"cityName":"杭州","currentConfirmedCount":143,"confirmedCount":328,"suspectedCount":0,"curedCount":185,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":330100,"currentConfirmedCountStr":"143"},{"cityName":"境外輸入","currentConfirmedCount":119,"confirmedCount":387,"suspectedCount":68,"curedCount":268,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":0,"currentConfirmedCountStr":"119"},{"cityName":"寧波","currentConfirmedCount":110,"confirmedCount":269,"suspectedCount":0,"curedCount":159,"deadCount":0,"highDangerCount":0,
'''
soup
= BeautifulSoup
(home_page
,'lxml')
script
= soup
.find
(id='getAreaStat')
text
= script
.text
print(text
)
'''
try { window.getAreaStat = [{"provinceName":"香港","provinceShortName":"香港","currentConfirmedCount":5990,"confirmedCount":22468,"suspectedCount":181,"curedCount":16190,"deadCount":288,"comment":"疑似 1 例","locationId":810000,"statisticsData":"https://file1.dxycdn.com/2020/0223/331/3398299755968040033-135.json","highDangerCount":0,"midDangerCount":0,"detectOrgCount":0,"vaccinationOrgCount":0,"cities":[],"dangerAreas":[]},{"provinceName":"臺灣","provinceShortName":"臺灣","currentConfirmedCount":5413,"confirmedCount":20007,"suspectedCount":485,"curedCount":13742,"deadCount":852,"comment":"","locationId":710000,"statisticsData":"https://file1.dxycdn.com/2020/0223/045/3398299749526003760-135.json","highDangerCount":0,"midDangerCount":0,"detectOrgCount":0,"vaccinationOrgCount":0,"cities":[],"dangerAreas":[]},{"provinceName":"浙江省","provinceShortName":"浙江","currentConfirmedCount":388,"confirmedCount":2255,"suspectedCount":68,"curedCount":1866,"deadCount":1,"comment":"2月10日通報核減的12例在浙江省治愈的外省病例,根據國家最新要求重新納入累計病例。","locationId":330000,"statisticsData":"https://file1.dxycdn.com/2020/0223/537/3398299755968455045-135.json","highDangerCount":0,"midDangerCount":0,"detectOrgCount":519,"vaccinationOrgCount":217,"cities":[{"cityName":"杭州","currentConfirmedCount":143,"confirmedCount":328,"suspectedCount":0,"curedCount":185,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":330100,"currentConfirmedCountStr":"143"},{"cityName":"境外輸入","currentConfirmedCount":119,"confirmedCount":387,"suspectedCount":68,"curedCount":268,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":0,"currentConfirmedCountStr":"119"},{"cityName":"寧波","currentConfirmedCount":110,"confirmedCount":269,"suspectedCount":0,"curedCount":159,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":330200,"currentConfirmedCountStr":"110"},{"cityName":"紹興","currentConfirmedCount":38,"confirmedCount":430,"suspectedCount":0,"curedCount":392,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":330600,"currentConfirmedCountStr":"38"},{"cityName":"金華","currentConfirmedCount":2,"confirmedCount":57,"suspectedCount":0,"curedCount":55,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":330700,"currentConfirmedCountStr":"2"},{"cityName":"溫州","currentConfirmedCount":0,"confirmedCount":504,"suspectedCount":0,"curedCount":503,"deadCount":1,"highDangerCount":0,"midDangerCount":0,"locationId":330300,"currentConfirmedCountStr":"0"},{"cityName":"臺州","currentConfirmedCount":0,"confirmedCount":147,"suspectedCount":0,"curedCount":147,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":331000,"currentConfirmedCountStr":"0"},{"cityName":"嘉興","currentConfirmedCount":0,"confirmedCount":46,"suspectedCount":0,"curedCount":46,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":330400,"currentConfirmedCountStr":"0"},{"cityName":"省十里豐監獄","currentConfirmedCount":0,"confirmedCount":36,"suspectedCount":0,"curedCount":36,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":0,"currentConfirmedCountStr":"0"},{"cityName":"麗水","currentConfirmedCount":0,"confirmedCount":17,"suspectedCount":0,"curedCount":17,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":331100,"currentConfirmedCountStr":"0"},{"cityName":"衢州","currentConfirmedCount":0,"confirmedCount":14,"suspectedCount":0,"curedCount":14,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":330800,"currentConfirmedCountStr":"0"},{"cityName":"湖州","currentConfirmedCount":0,"confirmedCount":10,"suspectedCount":0,"curedCount":10,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":330500,"currentConfirmedCountStr":"0"},{"cityName":"舟山","currentConfirmedCount":0,"confirmedCount":10,"suspectedCount":0,"curedCount":10,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":330900,"currentConfirmedCountStr":"0"},{"cityName":"待明確地區","currentConfirmedCount":-24,"confirmedCount":0,"suspectedCount":0,"curedCount":24,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":0,"notShowCurrentConfirmedCount":true,"currentConfirmedCountStr":"-"}],"dangerAreas":[]},{"provinceName":"廣東省","provinceShortName":"廣東","currentConfirmedCount":362,"confirmedCount":4163,"suspectedCount":25,"curedCount":3793,"deadCount":8,"comment":"廣東衛健委未明確部分治愈病例的地市歸屬,因此各地市的現存確診存在一定偏差。","locationId":440000,"statisticsData":"https://file1.dxycdn.com/2020/0223/281/3398299758115524068-135.json","highDangerCount":0,"midDangerCount":3,"detectOrgCount":120,"vaccinationOrgCount":42,"cities":[{"cityName":"深圳","currentConfirmedCount":145,"confirmedCount":798,"suspectedCount":3,"curedCount":650,"deadCount":3,"highDangerCount":0,"midDangerCount":3,"locationId":440300,"currentConfirmedCountStr":"145"},{"cityName":"廣州","currentConfirmedCount":103,"confirmedCount":2205,"suspectedCount":3,"curedCount":2101,"deadCount":1,"highDangerCount":0,"midDangerCount":0,"locationId":440100,"currentConfirmedCountStr":"103"},{"cityName":"東莞","currentConfirmedCount":31,"confirmedCount":202,"suspectedCount":1,"curedCount":170,"deadCount":1,"highDangerCount":0,"midDangerCount":0,"locationId":441900,"currentConfirmedCountStr":"31"},{"cityName":"佛山","currentConfirmedCount":28,"confirmedCount":318,"suspectedCount":1,"curedCount":290,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":440600,"currentConfirmedCountStr":"28"},{"cityName":"陽江","currentConfirmedCount":23,"confirmedCount":51,"suspectedCount":0,"curedCount":28,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":441700,"currentConfirmedCountStr":"23"},{"cityName":"珠海","currentConfirmedCount":15,"confirmedCount":169,"suspectedCount":2,"curedCount":153,"deadCount":1,"highDangerCount":0,"midDangerCount":0,"locationId":440400,"currentConfirmedCountStr":"15"},{"cityName":"惠州","currentConfirmedCount":7,"confirmedCount":71,"suspectedCount":0,"curedCount":64,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":441300,"currentConfirmedCountStr":"7"},{"cityName":"江門","currentConfirmedCount":7,"confirmedCount":47,"suspectedCount":0,"curedCount":40,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":440700,"currentConfirmedCountStr":"7"},{"cityName":"云浮","currentConfirmedCount":7,"confirmedCount":7,"suspectedCount":0,"curedCount":0,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":445300,"currentConfirmedCountStr":"7"},{"cityName":"中山","currentConfirmedCount":4,"confirmedCount":80,"suspectedCount":0,"curedCount":76,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":442000,"currentConfirmedCountStr":"4"},{"cityName":"湛江","currentConfirmedCount":2,"confirmedCount":43,"suspectedCount":2,"curedCount":41,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":440800,"currentConfirmedCountStr":"2"},{"cityName":"河源","currentConfirmedCount":1,"confirmedCount":6,"suspectedCount":0,"curedCount":5,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":441600,"currentConfirmedCountStr":"1"},{"cityName":"肇慶","currentConfirmedCount":0,"confirmedCount":47,"suspectedCount":1,"curedCount":46,"deadCount":1,"highDangerCount":0,"midDangerCount":0,"locationId":441200,"currentConfirmedCountStr":"0"},{"cityName":"汕頭","currentConfirmedCount":0,"confirmedCount":26,"suspectedCount":0,"curedCount":26,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":440500,"currentConfirmedCountStr":"0"},{"cityName":"清遠","currentConfirmedCount":0,"confirmedCount":23,"suspectedCount":0,"curedCount":23,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":441800,"currentConfirmedCountStr":"0"},{"cityName":"梅州","currentConfirmedCount":0,"confirmedCount":19,"suspectedCount":0,"curedCount":19,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":441400,"currentConfirmedCountStr":"0"},{"cityName":"茂名","currentConfirmedCount":0,"confirmedCount":17,"suspectedCount":0,"curedCount":17,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":440900,"currentConfirmedCountStr":"0"},{"cityName":"揭陽","currentConfirmedCount":0,"confirmedCount":11,"suspectedCount":0,"curedCount":11,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":445200,"currentConfirmedCountStr":"0"},{"cityName":"韶關","currentConfirmedCount":0,"confirmedCount":10,"suspectedCount":0,"curedCount":9,"deadCount":1,"highDangerCount":0,"midDangerCount":0,"locationId":440200,"currentConfirmedCountStr":"0"},{"cityName":"潮州","currentConfirmedCount":0,"confirmedCount":7,"suspectedCount":0,"curedCount":7,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":445100,"currentConfirmedCountStr":"0"},{"cityName":"汕尾","currentConfirmedCount":0,"confirmedCount":6,"suspectedCount":0,"curedCount":6,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":441500,"currentConfirmedCountStr":"0"},{"cityName":"待明確地區","currentConfirmedCount":-11,"confirmedCount":0,"suspectedCount":0,"curedCount":11,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":0,"notShowCurrentConfirmedCount":true,"currentConfirmedCountStr":"-"}],"dangerAreas":[{"cityName":"深圳","areaName":"龍崗區坂田街道馬安堂社區僑聯東10巷1號順興樓","dangerLevel":2},{"cityName":"深圳","areaName":"羅湖區東門街道新園路明華廣場1至6樓(含6A與M層)商業區","dangerLevel":2},{"cityName":"深圳","areaName":"中興路高時石材B區A鋼構廠房","dangerLevel":2}]},{"provinceName":"廣西壯族自治區","provinceShortName":"廣西","currentConfirmedCount":319,"confirmedCount":1028,"suspectedCount":0,"curedCount":707,"deadCount":2,"comment":"","locationId":450000,"statisticsData":"https://file1.dxycdn.com/2020/0223/536/3398299758115523880-135.json","highDangerCount":1,"midDangerCount":10,"detectOrgCount":270,"vaccinationOrgCount":15,"cities":[{"cityName":"百色","currentConfirmedCount":227,"confirmedCount":274,"suspectedCount":0,"curedCount":47,"deadCount":0,"highDangerCount":1,"midDangerCount":10,"locationId":451000,"currentConfirmedCountStr":"227"},{"cityName":"境外輸入","currentConfirmedCount":91,"confirmedCount":482,"suspectedCount":0,"curedCount":391,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":0,"currentConfirmedCountStr":"91"},{"cityName":"南寧","currentConfirmedCount":1,"confirmedCount":57,"suspectedCount":0,"curedCount":56,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":450100,"currentConfirmedCountStr":"1"},{"cityName":"北海","currentConfirmedCount":0,"confirmedCount":44,"suspectedCount":0,"curedCount":43,"deadCount":1,"highDangerCount":0,"midDangerCount":0,"locationId":450500,"currentConfirmedCountStr":"0"},{"cityName":"防城港","currentConfirmedCount":0,"confirmedCount":39,"suspectedCount":0,"curedCount":39,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":450600,"currentConfirmedCountStr":"0"},{"cityName":"桂林","currentConfirmedCount":0,"confirmedCount":32,"suspectedCount":0,"curedCount":32,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":450300,"currentConfirmedCountStr":"0"},{"cityName":"河池","currentConfirmedCount":0,"confirmedCount":28,"suspectedCount":0,"curedCount":27,"deadCount":1,"highDangerCount":0,"midDangerCount":0,"locationId":451200,"currentConfirmedCountStr":"0"},{"cityName":"柳州","currentConfirmedCount":0,"confirmedCount":24,"suspectedCount":0,"curedCount":24,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":450200,"currentConfirmedCountStr":"0"},{"cityName":"玉林","currentConfirmedCount":0,"confirmedCount":11,"suspectedCount":0,"curedCount":11,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":450900,"currentConfirmedCountStr":"0"},{"cityName":"來賓","currentConfirmedCount":0,"confirmedCount":11,"suspectedCount":0,"curedCount":11,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":451300,"currentConfirmedCountStr":"0"},{"cityName":"欽州","currentConfirmedCount":0,"confirmedCount":8,"suspectedCount":0,"curedCount":8,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":450700,"currentConfirmedCountStr":"0"},{"cityName":"貴港","currentConfirmedCount":0,"confirmedCount":8,"suspectedCount":0,"curedCount":8,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":450800,"currentConfirmedCountStr":"0"},{"cityName":"梧州","currentConfirmedCount":0,"confirmedCount":5,"suspectedCount":0,"curedCount":5,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":450400,"currentConfirmedCountStr":"0"},{"cityName":"賀州","currentConfirmedCount":0,"confirmedCount":4,"suspectedCount":0,"curedCount":4,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":451100,"currentConfirmedCountStr":"0"},{"cityName":"崇左","currentConfirmedCount":0,"confirmedCount":1,"suspectedCount":0,"curedCount":1,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":451400,"currentConfirmedCountStr":"0"}],"dangerAreas":[{"cityName":"百色","areaName":"德保縣都安鄉伏計村隴意屯","dangerLevel":1},{"cityName":"百色","areaName":"城關鎮隆盛社區東蒙榮盛二巷25號","dangerLevel":2},{"cityName":"百色","areaName":"城關鎮隆盛社區盛象名都小區","dangerLevel":2},{"cityName":"百色","areaName":"都安鄉坡那村多麥屯","dangerLevel":2},{"cityName":"百色","areaName":"德保縣都安鄉福記村山金屯","dangerLevel":2},{"cityName":"百色","areaName":"德保縣維也納酒店(德保騰飛廣場店)","dangerLevel":2},{"cityName":"百色","areaName":"東凌鎮登限村念洞屯","dangerLevel":2},{"cityName":"百色","areaName":"敬德鎮隴正村多果屯","dangerLevel":2},{"cityName":"百色","areaName":"靖西市武平鎮大道街大定屯","dangerLevel":2},{"cityName":"百色","areaName":"蓮城社區德立山莊","dangerLevel":2},{"cityName":"百色","areaName":"弄貼村新村屯","dangerLevel":2}]},{"provinceName":"上海市","provinceShortName":"上海","currentConfirmedCount":209,"confirmedCount":4003,"suspectedCount":393,"curedCount":3787,"deadCount":7,"comment":"因未公布分區死亡和治愈,僅展示累計確診和現存確診","locationId":310000,"statisticsData":"https://file1.dxycdn.com/2020/0223/128/3398299755968454977-135.json","highDangerCount":0,"midDangerCount":0,"detectOrgCount":130,"vaccinationOrgCount":17,"cities":[{"cityName":"境外輸入","currentConfirmedCount":208,"confirmedCount":3611,"suspectedCount":8,"curedCount":3403,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":0,"currentConfirmedCountStr":"208"},{"cityName":"奉賢區","currentConfirmedCount":1,"confirmedCount":11,"suspectedCount":0,"curedCount":10,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":310120,"currentConfirmedCountStr":"1"},{"cityName":"外地來滬","currentConfirmedCount":0,"confirmedCount":113,"suspectedCount":0,"curedCount":112,"deadCount":1,"highDangerCount":0,"midDangerCount":0,"locationId":0,"currentConfirmedCountStr":"0"},{"cityName":"浦東新區","currentConfirmedCount":0,"confirmedCount":82,"suspectedCount":0,"curedCount":81,"deadCount":1,"highDangerCount":0,"midDangerCount":0,"locationId":310115,"currentConfirmedCountStr":"0"},{"cityName":"寶山區","currentConfirmedCount":0,"confirmedCount":27,"suspectedCount":0,"curedCount":26,"deadCount":1,"highDangerCount":0,"midDangerCount":0,"locationId":310113,"currentConfirmedCountStr":"0"},{"cityName":"黃浦區","currentConfirmedCount":0,"confirmedCount":22,"suspectedCount":0,"curedCount":22,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":310101,"currentConfirmedCountStr":"0"},{"cityName":"閔行區","currentConfirmedCount":0,"confirmedCount":19,"suspectedCount":0,"curedCount":19,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":310112,"currentConfirmedCountStr":"0"},{"cityName":"徐匯區","currentConfirmedCount":0,"confirmedCount":18,"suspectedCount":0,"curedCount":17,"deadCount":1,"highDangerCount":0,"midDangerCount":0,"locationId":310104,"currentConfirmedCountStr":"0"},{"cityName":"靜安區","currentConfirmedCount":0,"confirmedCount":17,"suspectedCount":0,"curedCount":16,"deadCount":1,"highDangerCount":0,"midDangerCount":0,"locationId":310106,"currentConfirmedCountStr":"0"},{"cityName":"松江區","currentConfirmedCount":0,"confirmedCount":16,"suspectedCount":0,"curedCount":16,"deadCount":0,"highDangerCount":0,"midDangerCount":0,"locationId":310117,"currentConfirmedCountStr":"0"},{"cityName":"長寧區","currentConfirmedCount":0,"confirmedCount":14,"suspectedCount":0,"curedCount":14,"deadCount":...內容太多了已省略
'''
總結
以上是生活随笔為你收集整理的三、Beautiful Soup解析库的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。