python - 替换没有 python 外部库的代码
问题描述
由于此代码包含外部 python 库 lxml 但我需要更改代码以使其仅适用于 python 内部库 + 请求库。因为 Zapier 不支持外部库
from lxml import html
import requests
import lxml.html
# download & parse web page
doc = requests.get('https://www.makeuseof.com/feed/')
parser = lxml.html.fromstring(doc.content)
#find all image tags
x = parser.xpath('//img')
#get all image tags
la=[]
for t in x:
la.append((t.get("src")))
#remove multiple tags
for cell in set(la):
if cell is not None:
print(cell)
PS 我听说 urlib 可以做到,但我没有这样的想法。上面的代码也只是从提要页面中找到图像
解决方案
推荐阅读
- r - 如何在 ggplot2 中对条形图上的标签进行四舍五入?
- python - 知道为什么hackerrank 不接受我的代码,即使它准确地打印了所要求的内容
- git - Git 仅通过文件名记录日志以检测文件名是否曾经存在于 repo 中
- sqlite - 在哪里调用 IONIC SQLLITE 选择语句
- python - 密码更改后如何使密码重置令牌过期?
- ocaml - 关于在 OCaml 中读取整数/字符串输入的菜鸟问题
- gcc - 提取调试信息并将其存储到单独的文件中
- python - arcpy 中同一数据集中所有对象的重叠 (st_overlaps)
- r - ggplot2:使用独立的“Y”轴改变刻面宽度
- php - 无效的捆绑包模板覆盖