猿问

如何在python中的双花括号内抓取特定数据

我正在尝试从网站的双卷曲{}中的字符串中抓取特定数据。一个人如何设法取出这些数据?以下是该网站的双重卷曲片段:


<div class="swatch-data">

{"thumbnailImageUrl":"https://www.jbl.com.ph/dw/image/v2/AAUJ_PRD/on/demandware.static/-/Sites-masterCatalog_Harman/default/dw367304ef/JBL_Endurance-SPRINT_Product-Image_Black_Front-1605x1605px.jpg?sw=270&amp;sh=330&amp;sm=fit&amp;sfrm=png","productUrl":"https://www.jbl.com.ph/JBL+Endurance+SPRINT.html?cgid=in-ear-headphones&amp;dwvar_JBL%20Endurance%20SPRINT_color=Black-GLOBAL-","productSupportUrl":"","productID":"JBLENDURSPRINTBLK","orderable":false,"availability":{"message":"","status":"NOT_AVAILABLE"},"price":{"unitLabel":"each","priceType":"standard","salesPrice":"N/A"},"realprice":{"salesPrice":"N/A"},"badges":["new"],"buttonText":"Sold Out","showProdLimit":{"status":""},"CTAEnable":true,"commerceSiteFlag":false,"showPromoTimerFlag":false,"isProProd":false}

</div>

谢谢你。


编辑:PS。我确实使用BeautifulSoup4,但实际上我只是一个菜鸟,还没有使用JSON。


大话西游666
浏览 288回答 2
2回答
随时随地看视频慕课网APP

相关分类

Python
我要回答