相关疑难解决方法(0)

使用BeautifulSoup从未关闭的特定元标记中提取内容

我正在尝试解析特定元标记中的内容.这是元标记的结构.前两个用反斜杠关闭,但其余的没有任何结束标记.只要我获得第3个元标记,就会<head>返回标记之间的全部内容.我也尝试了,soup.findAll(text=re.compile('keyword'))但由于关键字是元标记的属性,因此不会返回任何内容.

<meta name="csrf-param" content="authenticity_token"/>
<meta name="csrf-token" content="OrpXIt/y9zdAFHWzJXY2EccDi1zNSucxcCOu8+6Mc9c="/>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
<meta content='en_US' http-equiv='Content-Language'>
<meta content='c2y_K2CiLmGeet7GUQc9e3RVGp_gCOxUC4IdJg_RBVo' name='google-site-    verification'>
<meta content='initial-scale=1.0,maximum-scale=1.0,width=device-width' name='viewport'>
<meta content='notranslate' name='google'>
<meta content="Learn about Uber's product, founders, investors and team. Everyone's Private Driver - Request a car from any mobile phone—text message, iPhone and Android apps. Within minutes, a professional driver in a sleek black car will arrive curbside. Automatically charged to your credit card on file, tip included." name='description'>
Run Code Online (Sandbox Code Playgroud)

这是代码:

import csv …
Run Code Online (Sandbox Code Playgroud)

python beautifulsoup

9
推荐指数
1
解决办法
2万
查看次数

标签 统计

beautifulsoup ×1

python ×1