It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center




9年前关闭。




我在字符串上有一个html响应。
我正在尝试从中制作一个HtmlXPathSelector,以便可以在其上使用xpaths。
但这表明,
TypeError: cannot create weak reference to 'str' obj

任何想法如何将字符串转换为HtmlXPathSelector接受的响应对象?

最佳答案

hxs = HtmlXPathSelector(text="my html")

关于从字符串中爬取HtmlXPathSelector,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8792684/

10-12 23:16