gpt4 book ai didi

python - 机械化可以完全替换为请求[python]

转载 作者:行者123 更新时间:2023-11-28 16:36:38 24 4
gpt4 key购买 nike

我在GitHub上找到一个python2项目,想把它转成python3。我只是想知道requests和mechanize是不是基本一样,可以互相替代。

最佳答案

没有。尽管它们具有一些相同的功能,但它们绝对不一样。 Mechanize 似乎具有比请求更多的功能。 Mechanize 能够“解决”页面上的表单,其中 Requests 只是拉取页面的原始 HTML 或与 Web API 交互。对于获得此功能的请求,需要另一个库。您可以将 Mehchanize 替换为 MechanicalSoup .事实上,创建者启动了 MechanicalSoup,因为 Mechanize 尚未移植到 3.*。

I was a fond user of the Mechanize library, but unfortunately it's incompatible with Python 3 and development is inactive. MechanicalSoup provides a similar API, built on Python giants Requests (for http sessions) and BeautifulSoup (for document navigation).

关于python - 机械化可以完全替换为请求[python],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25319889/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com