2
我看到如何获取Ruby中机械化的当前URL(mechanize how to get current url)的答案,但是如何为python机械化做到这一点?如何在python机械化中找到当前的URL?
文档似乎并不很... ...彻底
我看到如何获取Ruby中机械化的当前URL(mechanize how to get current url)的答案,但是如何为python机械化做到这一点?如何在python机械化中找到当前的URL?
文档似乎并不很... ...彻底
那么,它可能不是很透彻,但仍there is what you need:
import mechanize
br = mechanize.Browser()
br.open("http://www.example.com/")
# follow second link with element text matching regular expression
response1 = br.follow_link(text_regex=r"cheese\s*shop", nr=1)
print response1.geturl()
作为一个侧面说明,当我我正在寻找这样的方法,而且我没有在文档中找到它们,我通常会打开一个IPython shell,然后使用自动完成功能来查看是否有某种方法看起来不错。
谢谢。并感谢您的建议。我一定会这么做!:) – Edasaur