python - 如何从标签“澳大利亚”中获取“澳大利亚”
问题描述
我正试图从这个标签中抓住澳大利亚
<tr>
<td>City</td>
<th>Sydney</th>
</tr>
<tr>
<td>Country</td>
<th>Australia</th>
</tr>
import re
from re import findall
a = '<tr>\n<td>Country</td>\n<th>Australia</th>\n</tr>'
country = re.findall(r'<tr><td>Country</td><th>(.*?)</th></tr>',a)
print country
result: []
这是一个 html 代码,我尝试使用 import re 和 from re import findall 来抓取澳大利亚
我期待结果:澳大利亚,但它给了我结果:[]
我不想用beautifulsoup。谢谢
解决方案
推荐阅读
- aws-kms - AWS DMS S3 终端节点 SSE-KMS (InvalidParameterCombinationException)
- optimization - dynamodb 中的查询与扫描操作
- mongodb - Mongoose/Mongodb,更新每个文档查询,很慢
- c# - 如何检查在 OnTriggerEnter 中的对象上找到的文本
- javascript - 将 JS 与 rollup 和 Babel 捆绑以在 IE11 中使用
- sql - SQL中每3个月累积值的估计
- javascript - TypeScript 编译移除了导入和导出
- python - 在 pandas 组中应用多个函数而无需迭代
- java - 如何获取服务基础设施的 proto 文件
- arrays - Brain Bender... 数组公式未使用 FILTER 函数填充单元格