python - 如何使用 findall 查找所有信息
问题描述
我试图使用 findall 函数查找和打印一定数量的文本。无论如何,我似乎无法让它工作。在再次使用 findall 函数以获得我想要的内容之前,我尝试将所有信息打印并存储在一个变量中。我必须分两步完成,因为如果我直接搜索 src,我会从文档的其他区域得到其他垃圾。
这是我到目前为止所做的。
## locate a section of text containging the img source
html_img_source_and_junk = findall('</noscript>[\s]+<img[\s]+src="([^"]+)"[\s]+alt', html_source_whittakers)
print(html_img_source_and_junk)
这是我试图提取的信息文本。
没有脚本>
<图片
src="//cdn.shopify.com/s/files/1/0274/7315/products/whi_225x225.jpg?v=1525431190"
alt="
解决方案
推荐阅读
- c# - C#如何获取当前的 24 小时时间但从早上 8 点开始
- javascript - 如何在 jQuery 工具提示中装饰 Laravel Eloquent 信息?
- javascript - JQuery:使用类名自动填充多个内容可编辑项
- python-3.x - 验证正确安装 tensorflow 时出错
- laravel - 无法与主机 smtp.gmail.com 建立连接 [网络无法访问 #101]
- c# - UWP 指定的缓冲区索引不在缓冲区容量之内
- android - 我的 StateButton 状态没有更新我的视图
- javascript - 为什么 Whatsapp 和 Javascript 返回相同 unicode 字符串的不同长度?
- python - Python 将 \) 替换为 )
- vala - Vala:如何将指针传递给外部代码?