<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          mechanizePython的HTML解析

          聯(lián)合創(chuàng)作 · 2023-09-22 00:09

          當(dāng)您希望與 Web 頁面中找到的內(nèi)容進(jìn)行某種比較復(fù)雜的交互時,您需要使用 mechanize

          示例代碼:

          import re
          from mechanize import Browser

          br = 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)
          assert br.viewing_html()
          print br.title()
          print response1.geturl()
          print response1.info() # headers
          print response1.read() # body
          response1.close() # (shown for clarity; in fact Browser does this for you)

          br.select_form(name="order")
          # Browser passes through unknown attributes (including methods)
          # to the selected HTMLForm (from ClientForm).
          br["cheeses"] = ["mozzarella", "caerphilly"] # (the method here is __setitem__)
          response2 = br.submit() # submit current form

          # print currently selected form (don't call .submit() on this, use br.submit())
          print br.form
          瀏覽 16
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評論
          圖片
          表情
          推薦
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  四虎殴美| 欧美成人午夜一区二区三区 | 日本成人免费电影一区二区三区 | 中文无码高清在线 | 久久亚洲一区女同性恋中文字幕 |