使用 chaquopy 在 Android Studio 中实现 BeautifulSoup
Posted
技术标签:
【中文标题】使用 chaquopy 在 Android Studio 中实现 BeautifulSoup【英文标题】:Implementing BeautifulSoup to Android Studio with chaquopy 【发布时间】:2022-01-09 13:54:34 【问题描述】:我目前正在使用带有 BeautifulSoup 的 android Studio 制作网页抓取应用。如何实现
从 bs4 导入 BeautifulSoup
像在 Python 中一样进入 Android Studio?
我的 build.gradle 是
python
buildPython "C:/Python38/python.exe"
pip
install "bs4"
install "beautifulsoup4"
install "requests"
我在 Python 中的导入是
from bs4 import BeautifulSoup
import requests
【问题讨论】:
【参考方案1】:而不是使用
soup = BeautifulSoup(html_text, 'lxml')
我用过
soup = BeautifulSoup(html_text, 'html.parser')
在 Python 文件中,它似乎完成了这项工作。
【讨论】:
要使用 lxml,您可以将“lxml”添加到您的pip install
列表中。以上是关于使用 chaquopy 在 Android Studio 中实现 BeautifulSoup的主要内容,如果未能解决你的问题,请参考以下文章
在 android studio 中使用 chaquopy 运行 python 脚本
使用 chaquopy 在 android studio 中集成 python 代码(对象检测代码)
在 android studio 中使用 chaquopy 加载模型 hdf5
如何在使用 Chaquopy 时在 android 中显示加载动画