<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                一個從百度貼吧,爬取圖片的例子。 ### 包 urllib,urllib2,re ### 函數 page=urllib.urlopen('http://...') ?返回一個網頁對象 html=page.read() ? 讀取網頁的html源碼 urllib.urlretrieve() ?下載資源到本地 ### 代碼 ~~~ #coding:utf8 import re import urllib def getHtml(url): page=urllib.urlopen(url) html=page.read() return html def getImgUrl(html): reg=r'src="(.*?\.jpg)"'#?非貪婪匹配,()分組只返回分組結果,外單引號內雙引號 imgre=re.compile(reg)#編譯正則表達式,加快速度 imglist=re.findall(imgre,html) return imglist url="http://tieba.baidu.com/p/3162606526"#貼吧地址 html=getHtml(url) ImgList=getImgUrl(html) ImgList= ImgList[1:10]#取前10個下載 print ImgList x=0 for imgurl in ImgList: urllib.urlretrieve(imgurl,'%s.jpg' %x) x+=1 ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看