当前位置:  开发笔记 > 编程语言 > 正文

python实现爬虫下载漫画示例

本文主要介绍了python实现爬虫下载漫画的示例,对游侠网的漫画资源进行解析,下载其全部章节漫画

复制代码 代码如下:

#!/usr/bin/python3.2
import os,socket
import urllib
import urllib.request,threading,time
import re,sys
global manhuaweb,weburl,floder,chapterbegin,currentthreadnum,threadcount,mutex,mutex2

weburl=''
floder=''
chapterbegin=0
currentthreadnum=0
threadcount=6


if len(sys.argv)>=3:
  weburl=sys.argv[1]
  floder=sys.argv[2]
else:
    print("usag: downloadmanhua weburl floder chapterbegin=0 threadnnum=6")
    sys.exit(0)
if len(sys.argv)>=4:
  chapterbegin=int(sys.argv[3])
if len(sys.argv)>=5:
  threadcount=(int)(sys.argv[4])

 

def jin(i,jinzhi):
        finalans=""
        answer=i%jinzhi
        i=int(i/jinzhi)
        if answer>9:
                finalans=finalans+chr(ord('a')+(answer-10))
        else:
                finalans=finalans+str(answer)
        if i!=0:
                finalans=jin(i,jinzhi)+finalans
        return finalans
def urlparse(p,a,c,k):
        d={}
        e=lambda c:     jin(c,36)
        if 1:
                while c:
                        c=c-1
                        if not k[c]:
                                d[jin(c,36)]=jin(c,36)
                        else:
                                d[jin(c,36)]=k[c]
                k=[lambda e:d[e]]
                e=lambda c:'\\w+'
                c=1
        newstr=""
        while c:
                c=c-1
                if k[c]:
                        for i in range(0,len(p)):
                                tempi=p[i]
                                tempi=ord(tempi)
                                if tempi>=ord('a') and tempi<=ord('f'):
                                        newstr+=d[chr(tempi)]
                                elif tempi>=ord('0') and tempi<=ord('9'):
                                        newstr+=d[chr(tempi)]
                                else:
                                        newstr+=chr(tempi)
        return newstr
def meispower(s):
        p=re.compile(r"(?=\}\().*",re.IGNORECASE)
        s=p.findall(s)
        s=s[0]
        s=s[0:(len(s)-19)]
        par=s.split(',')
        par[3]=par[3][1:len(par[3])]
        answer=par[3].split('|')
        chapterpath=urlparse(par[0],int(par[1]),int(par[2]),answer)
        allurl=re.findall('imgpath=[^;]*',chapterpath)[0]
        allurl=allurl[10:(len(allurl)-2)]
        return allurl
def pictofile(weburl,filename,loop=100):
        if loop<0:
                print('can\'t download the picture %s'%weburl)
                return
        loop=loop-1
        if os.path.exists(filename):
            return
        try:
                url=urllib.request.urlopen(weburl)
                data=url.read()
                if len(data)<2048:
                        url.close()
                        pictofile(weburl,filename,loop)
                else:
                        print('download from %s name is %s\n'%(weburl,filename))
                        myfile=open('%s'%filename,'wb')
                        myfile.write(data)
                        myfile.close()
                        url.close();
        except socket.timeout:
                print('timeout')
                pictofile(weburl,filename,loop)
        except Exception as e:
          print('error',e)
          pictofile(weburl,filename,loop)
        finally:
            pass
def downloadpic(url,loadpicdir,num):
    #download the all url picture to loadpicdir
    global currentthreadnum,mutex,mutex2
    mymode=re.compile(r'[0-9a-z.]*\Z')
    try:
                mutex2.acquire()
                os.chdir(loadpicdir)
                mutex2.release()
    except:
                print("can't open the floder %s will be create"%loadpicdir)
                try:
                    if(mutex2.locked()):
                        os.mkdir(loadpicdir)
                        os.chdir(loadpicdir)
                        mutex2.release()
                    print('create floder succeed')
                except:
                    print("can't create floder %s"%loadpicdir)
                    if(mutex.acquire()):
                        mutex.release()
                    quit(0)
    name=mymode.findall(url)
    filename='manhua'+name[0]
    pictofile(url,loadpicdir+'//'+str(num)+'-'+filename)
    mutex.acquire()
    currentthreadnum=currentthreadnum-1
    mutex.release()
def downloadchapter(url,loadpicdir,num,begin=0):
        global manhuaweb,threadcount,currentthreadnum,mutex
        print(manhuaweb+url)
        webdata=urllib.request.urlopen(manhuaweb+url).read()
        webdata=webdata.decode('UTF-8')
        chaptername=re.findall(r'[^_]*',webdata)[0]<BR>        chaptername=chaptername[7:len(chaptername)]<BR>        webscrip=re.findall(r'eval.*[^<>]',webdata)<BR>        chapterurl=meispower(webscrip[0]);<BR>        chapterurl='http://mhimg.ali213.net'+chapterurl<BR>        for i in range(begin,num):<BR>                try:<BR>                        while(currentthreadnum>=threadcount):<BR>                                time.sleep(0.5)<BR>                        mutex.acquire()<BR>                        currentthreadnum=currentthreadnum+1<BR>                        mutex.release()<BR>                        threading.Thread(target=downloadpic,args=(r'%s%d.jpg'%(chapterurl,i),loadpicdir+chaptername,num)).start()<BR>                except socket.error:<BR>                        mutex.acquire()<BR>                        i=i-1<BR>                        currentthreadnum=currentthreadnum-1<BR>                        mutex.release()<BR>                except Exception as error:<BR>                        print(error,'break')<BR>                        print('download chapter %d of picture make a error'%i)<BR>                        break<BR>if __name__=='__main__':<BR>        manhuaweb=r'http://manhua.ali213.net'<BR>        socket.setdefaulttimeout(60.0)<BR>        mutex=threading.Lock()<BR>        mutex2=threading.Lock()</P> <P>        <BR>        webfile=urllib.request.urlopen(weburl)<BR>        webdata=webfile.read();<BR>        webdata=webdata.decode('UTF-8')<BR>        meshmode=re.compile(r'<div class="detail_body_right_sec_con">.*</div>')<BR>        meshdata=meshmode.findall(webdata)[0]<BR>        indexmode=re.compile(r'([0-9]*页)')<BR>        indexdata=indexmode.findall(meshdata)</P> <P>        picurlmode=re.compile(r'/comic/[0-9/]*.html')<BR>        picurldata=picurlmode.findall(meshdata)</P> <P><BR>        chapterlength=len(picurldata)<BR>        nummode=re.compile(r'[\d]+')</P> <P>        i=chapterbegin<BR>        while i<chapterlength:<BR>                manhuachapter=picurldata[chapterlength-i-1]<BR>                downloadchapter(manhuachapter,floder,int(nummode.findall(indexdata[chapterlength-i-1])[0]))<BR>                i=i+1<BR></div></P> </div> <div class="article_ab" style="width: 720px;height: 100px;margin: 0 auto;margin-top: 15px;"> </div> <div class="article_recommend"> <div class="list_top">推荐阅读</div> <div class="ListItems"> <ul class="NewsList"> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/AzureRESTAPI-_Yo_b67e2f1e.html" target="_blank" title="Azure REST API - 用于获取所有虚拟机的查询参数">Azure REST API - 用于获取所有虚拟机的查询参数</a></h2> </div> <div class="NewsInfo"> <div class="NewsDesc" > 如何解决《AzureRESTAPI-用于获取所有虚拟机的查询参数》经验,为你挑选了1个好方法。 ... <a href="https://devbox.cn/p/AzureRESTAPI-_Yo_b67e2f1e.html" target="_blank" title="Azure REST API - 用于获取所有虚拟机的查询参数">[详细]</a> </div> <div style="clear:both"></div> </li> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/TongGuo_ng-click_e7367cef.html" target="_blank" title="通过ng-click将ng-model变量传递给函数">通过ng-click将ng-model变量传递给函数</a></h2> </div> <div class="NewsInfo"> <div class="NewsDesc" > 如何解决《通过ng-click将ng-model变量传递给函数》经验,为你挑选了1个好方法。 ... <a href="https://devbox.cn/p/TongGuo_ng-click_e7367cef.html" target="_blank" title="通过ng-click将ng-model变量传递给函数">[详细]</a> </div> <div style="clear:both"></div> </li> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/MYSQL-select_DeY_65e86c79.html" target="_blank" title="MYSQL:select的意外结果">MYSQL:select的意外结果</a></h2> </div> <div class="NewsInfo"> <div class="NewsDesc" > 如何解决《MYSQL:select的意外结果》经验,为你挑选了1个好方法。 ... <a href="https://devbox.cn/p/MYSQL-select_DeY_65e86c79.html" target="_blank" title="MYSQL:select的意外结果">[详细]</a> </div> <div style="clear:both"></div> </li> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/Docker_RongQiJiQ_11f12f35.html" target="_blank" title="Docker容器集群">Docker容器集群</a></h2> </div> <div class="NewsInfo"> <div class="NewsImg"> <a href="https://devbox.cn/p/Docker_RongQiJiQ_11f12f35.html" target="_blank" title="Docker容器集群"><img src="https://img.devbox.cn/3cccf/16086/243/63d1fb966cd748b8.png" width="120" height="70" alt="Docker容器集群"/></a> </div> <div class="NewsDesc" style="width:500px;margin-left:15px;"> 如何解决《Docker容器集群》经验,为你挑选了1个好方法。 ... <a href="https://devbox.cn/p/Docker_RongQiJiQ_11f12f35.html" target="_blank" title="Docker容器集群">[详细]</a> </div> <div style="clear:both"></div> </li> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/Chrome_KongZhiTa_5e46ea1f.html" target="_blank" title="Chrome控制台清除分配和变量">Chrome控制台清除分配和变量</a></h2> </div> <div class="NewsInfo"> <div class="NewsImg"> <a href="https://devbox.cn/p/Chrome_KongZhiTa_5e46ea1f.html" target="_blank" title="Chrome控制台清除分配和变量"><img src="https://img.devbox.cn/3cccf/16086/243/fc625743366a4cce.png" width="120" height="70" alt="Chrome控制台清除分配和变量"/></a> </div> <div class="NewsDesc" style="width:500px;margin-left:15px;"> 如何解决《Chrome控制台清除分配和变量》经验,为你挑选了4个好方法。 ... <a href="https://devbox.cn/p/Chrome_KongZhiTa_5e46ea1f.html" target="_blank" title="Chrome控制台清除分配和变量">[详细]</a> </div> <div style="clear:both"></div> </li> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/R-dplyr_RongHePe_68e46773.html" target="_blank" title="R - dplyr融合配对数据的交叉">R - dplyr融合配对数据的交叉</a></h2> </div> <div class="NewsInfo"> <div class="NewsDesc" > 如何解决《R-dplyr融合配对数据的交叉》经验,为你挑选了1个好方法。 ... <a href="https://devbox.cn/p/R-dplyr_RongHePe_68e46773.html" target="_blank" title="R - dplyr融合配对数据的交叉">[详细]</a> </div> <div style="clear:both"></div> </li> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/Java_RengZaiYunX_e15feec7.html" target="_blank" title="Java仍在运行时重新创建日志文件">Java仍在运行时重新创建日志文件</a></h2> </div> <div class="NewsInfo"> <div class="NewsDesc" > 如何解决《Java仍在运行时重新创建日志文件》经验,为你挑选了0个好方法。 ... <a href="https://devbox.cn/p/Java_RengZaiYunX_e15feec7.html" target="_blank" title="Java仍在运行时重新创建日志文件">[详细]</a> </div> <div style="clear:both"></div> </li> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/ShouYiLvShiFouKe_51914f0d.html" target="_blank" title="收益率是否可以折返?">收益率是否可以折返?</a></h2> </div> <div class="NewsInfo"> <div class="NewsDesc" > 如何解决《收益率是否可以折返?》经验,为你挑选了0个好方法。 ... <a href="https://devbox.cn/p/ShouYiLvShiFouKe_51914f0d.html" target="_blank" title="收益率是否可以折返?">[详细]</a> </div> <div style="clear:both"></div> </li> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/MySQL-_Cong_time_9d45fafd.html" target="_blank" title="MySQL - 从timestamp列选择每2小时的间隔">MySQL - 从timestamp列选择每2小时的间隔</a></h2> </div> <div class="NewsInfo"> <div class="NewsDesc" > 如何解决《MySQL-从timestamp列选择每2小时的间隔》经验,为你挑选了1个好方法。 ... <a href="https://devbox.cn/p/MySQL-_Cong_time_9d45fafd.html" target="_blank" title="MySQL - 从timestamp列选择每2小时的间隔">[详细]</a> </div> <div style="clear:both"></div> </li> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/CiZiChaXunChuCuo_215e0b7a.html" target="_blank" title="此子查询出错">此子查询出错</a></h2> </div> <div class="NewsInfo"> <div class="NewsDesc" > 如何解决《此子查询出错》经验,为你挑选了1个好方法。 ... <a href="https://devbox.cn/p/CiZiChaXunChuCuo_215e0b7a.html" target="_blank" title="此子查询出错">[详细]</a> </div> <div style="clear:both"></div> </li> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/VisualStudio2015_2400dc56.html" target="_blank" title="Visual Studio 2015不断切换启动项目">Visual Studio 2015不断切换启动项目</a></h2> </div> <div class="NewsInfo"> <div class="NewsImg"> <a href="https://devbox.cn/p/VisualStudio2015_2400dc56.html" target="_blank" title="Visual Studio 2015不断切换启动项目"><img src="https://img.devbox.cn/3cccf/16086/243/63d1fb966cd748b8.png" width="120" height="70" alt="Visual Studio 2015不断切换启动项目"/></a> </div> <div class="NewsDesc" style="width:500px;margin-left:15px;"> 如何解决《VisualStudio2015不断切换启动项目》经验,为你挑选了3个好方法。 ... <a href="https://devbox.cn/p/VisualStudio2015_2400dc56.html" target="_blank" title="Visual Studio 2015不断切换启动项目">[详细]</a> </div> <div style="clear:both"></div> </li> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/ShiYong_Dapper_Z_531fbae3.html" target="_blank" title="使用Dapper自动映射输出参数">使用Dapper自动映射输出参数</a></h2> </div> <div class="NewsInfo"> <div class="NewsDesc" > 如何解决《使用Dapper自动映射输出参数》经验,为你挑选了0个好方法。 ... <a href="https://devbox.cn/p/ShiYong_Dapper_Z_531fbae3.html" target="_blank" title="使用Dapper自动映射输出参数">[详细]</a> </div> <div style="clear:both"></div> </li> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/RuHeQingChuShuZu_9e99ed0d.html" target="_blank" title="如何清除数组中的TextField?">如何清除数组中的TextField?</a></h2> </div> <div class="NewsInfo"> <div class="NewsDesc" > 如何解决《如何清除数组中的TextField?》经验,为你挑选了1个好方法。 ... <a href="https://devbox.cn/p/RuHeQingChuShuZu_9e99ed0d.html" target="_blank" title="如何清除数组中的TextField?">[详细]</a> </div> <div style="clear:both"></div> </li> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/JiangYuYanGengGa_e126eb31.html" target="_blank" title="将语言更改为Bootstrap Datetimepicker">将语言更改为Bootstrap Datetimepicker</a></h2> </div> <div class="NewsInfo"> <div class="NewsDesc" > 如何解决《将语言更改为BootstrapDatetimepicker》经验,为你挑选了1个好方法。 ... <a href="https://devbox.cn/p/JiangYuYanGengGa_e126eb31.html" target="_blank" title="将语言更改为Bootstrap Datetimepicker">[详细]</a> </div> <div style="clear:both"></div> </li> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/WenJianXiTongBia_3bfb5e6d.html" target="_blank" title="文件系统变为只读时的弹性搜索">文件系统变为只读时的弹性搜索</a></h2> </div> <div class="NewsInfo"> <div class="NewsDesc" > 如何解决《文件系统变为只读时的弹性搜索》经验,为你挑选了0个好方法。 ... <a href="https://devbox.cn/p/WenJianXiTongBia_3bfb5e6d.html" target="_blank" title="文件系统变为只读时的弹性搜索">[详细]</a> </div> <div style="clear:both"></div> </li> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/RuHeYueDu_appSet_41f5e7d9.html" target="_blank" title="如何阅读appSettings键">如何阅读appSettings键</a></h2> </div> <div class="NewsInfo"> <div class="NewsDesc" > 如何解决《如何阅读appSettings键》经验,为你挑选了1个好方法。 ... <a href="https://devbox.cn/p/RuHeYueDu_appSet_41f5e7d9.html" target="_blank" title="如何阅读appSettings键">[详细]</a> </div> <div style="clear:both"></div> </li> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/RuHeCongJiGe_INS_3070ce49.html" target="_blank" title="如何从几个INSERT中插入id">如何从几个INSERT中插入id</a></h2> </div> <div class="NewsInfo"> <div class="NewsDesc" > 如何解决《如何从几个INSERT中插入id》经验,为你挑选了1个好方法。 ... <a href="https://devbox.cn/p/RuHeCongJiGe_INS_3070ce49.html" target="_blank" title="如何从几个INSERT中插入id">[详细]</a> </div> <div style="clear:both"></div> </li> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/Cong_javascripto_7b5bfcc8.html" target="_blank" title="从javascript onclick返回值到变量或使用onclick更改全局变量">从javascript onclick返回值到变量或使用onclick更改全局变量</a></h2> </div> <div class="NewsInfo"> <div class="NewsImg"> <a href="https://devbox.cn/p/Cong_javascripto_7b5bfcc8.html" target="_blank" title="从javascript onclick返回值到变量或使用onclick更改全局变量"><img src="https://img.devbox.cn/3cccf/16086/243/8e8f4e2f18ab13a1.png" width="120" height="70" alt="从javascript onclick返回值到变量或使用onclick更改全局变量"/></a> </div> <div class="NewsDesc" style="width:500px;margin-left:15px;"> 如何解决《从javascriptonclick返回值到变量或使用onclick更改全局变量》经验,为你挑选了0个好方法。 ... <a href="https://devbox.cn/p/Cong_javascripto_7b5bfcc8.html" target="_blank" title="从javascript onclick返回值到变量或使用onclick更改全局变量">[详细]</a> </div> <div style="clear:both"></div> </li> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/AnHanShuMingChen_d11f3296.html" target="_blank" title="按函数名称c ++ 11参数化模板">按函数名称c ++ 11参数化模板</a></h2> </div> <div class="NewsInfo"> <div class="NewsDesc" > 如何解决《按函数名称c++11参数化模板》经验,为你挑选了0个好方法。 ... <a href="https://devbox.cn/p/AnHanShuMingChen_d11f3296.html" target="_blank" title="按函数名称c ++ 11参数化模板">[详细]</a> </div> <div style="clear:both"></div> </li> <li> <div class="NewTitle"> <a class="cat" href="/tag/程序员" title="程序员" target="_blank">程序员<i></i></a> <h2><a href="https://devbox.cn/p/UWPApp_ZhongDeJi_9ff4b491.html" target="_blank" title="UWP App中的计时器未链接到UI">UWP App中的计时器未链接到UI</a></h2> </div> <div class="NewsInfo"> <div class="NewsDesc" > 如何解决《UWPApp中的计时器未链接到UI》经验,为你挑选了2个好方法。 ... <a href="https://devbox.cn/p/UWPApp_ZhongDeJi_9ff4b491.html" target="_blank" title="UWP App中的计时器未链接到UI">[详细]</a> </div> <div style="clear:both"></div> </li> </ul> </div> </div> <div class="article_cmnt" style="display: none;"> <div class="cmnt_title">吐了个 "CAO" !</div> <form action="" method="post"> <div class="cmnt_text"> <textarea class="ping-txt" onfocus="ck_txt(this);" onblur="ck_txt2(this);" id="ping-txt" name="ping-txt" >吐个槽吧,看都看了</textarea> </div> <div class="cmnt_cmt"> <div class="cmnt_login_box"> <a href="https://www.php1.cn/?s=user/login/index&from=">会员登录</a> | <a href="http://www.php1.cn/?s=user/reg/index">用户注册</a> </div> <div class="post_cmnt"><input type="button" value="吐  槽" onclick="post_ping();" /></div> </div> </form> </div> </div> <script type="text/javascript" src="/style/SyntaxHighlighter/scripts/shCore.js"></script> <script type="text/javascript" src="/style/SyntaxHighlighter/scripts/shBrushBash.js"></script> <script type="text/javascript" src="/style/SyntaxHighlighter/scripts/shBrushCpp.js"></script> <script type="text/javascript" src="/style/SyntaxHighlighter/scripts/shBrushCSharp.js"></script> <script type="text/javascript" src="/style/SyntaxHighlighter/scripts/shBrushCss.js"></script> <script type="text/javascript" src="/style/SyntaxHighlighter/scripts/shBrushDelphi.js"></script> <script type="text/javascript" src="/style/SyntaxHighlighter/scripts/shBrushDiff.js"></script> <script type="text/javascript" src="/style/SyntaxHighlighter/scripts/shBrushGroovy.js"></script> <script type="text/javascript" src="/style/SyntaxHighlighter/scripts/shBrushJava.js"></script> <script type="text/javascript" src="/style/SyntaxHighlighter/scripts/shBrushJScript.js"></script> <script type="text/javascript" src="/style/SyntaxHighlighter/scripts/shBrushPhp.js"></script> <script type="text/javascript" src="/style/SyntaxHighlighter/scripts/shBrushPlain.js"></script> <script type="text/javascript" src="/style/SyntaxHighlighter/scripts/shBrushPython.js"></script> <script type="text/javascript" src="/style/SyntaxHighlighter/scripts/shBrushRuby.js"></script> <script type="text/javascript" src="/style/SyntaxHighlighter/scripts/shBrushScala.js"></script> <script type="text/javascript" src="/style/SyntaxHighlighter/scripts/shBrushSql.js"></script> <script type="text/javascript" src="/style/SyntaxHighlighter/scripts/shBrushVb.js"></script> <script type="text/javascript" src="/style/SyntaxHighlighter/scripts/shBrushXml.js"></script> <link type="text/css" rel="stylesheet" href="/style/SyntaxHighlighter/styles/shCore.css"/> <link type="text/css" rel="stylesheet" href="/style/SyntaxHighlighter/styles/shThemeLiuQing.css"/> <style> .syntaxhighlighter{ width: 740px; padding-top:40px;padding-bottom:20px; border: 1px solid #333; background: url("/style/SyntaxHighlighter/top_bg.svg"); background-size: 43px; background-repeat: no-repeat; margin-bottom: -7px; border-radius: 15px; background-position: 16px 12px; padding-left: 10px; } .gutter{ display: none; } </style> <script type="text/javascript"> SyntaxHighlighter.all(); </script> <div class="article_right"> <div class="profile"> <div class="author"> <!-- 未登录 --> <div class="author-avatar"> <a href="/u/xiaoyao_694_807"> <img src="https://img.devbox.cn/3cdc5/64c2/cd5/f53c066002fa970f.png" class="lazy-img" data-url="" alt="devbox"> </a> </div> <div class="author-name"> 小妖694_807 </div> <div class="author-intro"> 这个屌丝很懒,什么也没留下! </div> <div class="author-bt"> <a href="javascript:;" id="follow_bt" onclick="follow();" class="skins-btn" title="关注作者"> <svg class="icon" style="width: 15px;height: 15px;margin-top:-3px;margin-right:5px;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1428"><path d="M1024 409.6H614.4V0H409.6v409.6H0v204.8h409.6v409.6h204.8V614.4h409.6z" fill="#ffffff" p-id="1429"></path></svg> 关注作者</a> </div> </div> </div> <div class="tools"> <div class="tools_top">Tags | 热门标签</div> <div class="tools_box"> <ul> <li> <a href="/tag/actionscrip" target="_blank" title="actionscrip">actionscrip</a> </li> <li> <a href="/tag/bash" target="_blank" title="bash">bash</a> </li> <li> <a href="/tag/c#" target="_blank" title="c#">c#</a> </li> <li> <a href="/tag/c++" target="_blank" title="c++">c++</a> </li> <li> <a href="/tag/c语言" target="_blank" title="c语言">c语言</a> </li> <li> <a href="/tag/erlang" target="_blank" title="erlang">erlang</a> </li> <li> <a href="/tag/flutter" target="_blank" title="flutter">flutter</a> </li> <li> <a href="/tag/go" target="_blank" title="go">go</a> </li> <li> <a href="/tag/golang" target="_blank" title="golang">golang</a> </li> <li> <a href="/tag/java" target="_blank" title="java">java</a> </li> <li> <a href="/tag/javascript" target="_blank" title="javascript">javascript</a> </li> <li> <a href="/tag/lua" target="_blank" title="lua">lua</a> </li> <li> <a href="/tag/node.js" target="_blank" title="node.js">node.js</a> </li> <li> <a href="/tag/perl" target="_blank" title="perl">perl</a> </li> <li> <a href="/tag/php" target="_blank" title="php">php</a> </li> <li> <a href="/tag/python" target="_blank" title="python">python</a> </li> <li> <a href="/tag/scala" target="_blank" title="scala">scala</a> </li> <li> <a href="/tag/typescript" target="_blank" title="typescript">typescript</a> </li> <div style="clear: both"></div> </ul> </div> </div> <div class="rank"> <div class="rank_top">RankList | 热门文章</div> <div class="rank_box"> <ul> <li> <b >1</b><a href="https://devbox.cn/p/RuHeJiangShuChuX_362d958d.html" title="如何将输出写入文件python" target="_blank">如何将输出写入文件python</a> </li> <li> <b >2</b><a href="https://devbox.cn/p/XAMPPforWindows6_ad93195a.html" title="XAMPP for Windows 64位机器" target="_blank">XAMPP for Windows 64位机器</a> </li> <li> <b >3</b><a href="https://devbox.cn/p/iOS-_Shi_UIImage_af342a46.html" title="iOS - 使UIImageView调整大小以适应UILabel和AutoLayout" target="_blank">iOS - 使UIImageView调整大小以适应UILabel和AutoLayout</a> </li> <li> <b >4</b><a href="https://devbox.cn/p/ShanChu_-git-_Ho_2473ee82.html" title="删除.git /后修复git repo" target="_blank">删除.git /后修复git repo</a> </li> <li> <b >5</b><a href="https://devbox.cn/p/WuFaHuoDe_Tweet__dd52e3d5.html" title="无法获得Tweet的国家 - Twython API" target="_blank">无法获得Tweet的国家 - Twython API</a> </li> <li> <b class="black">6</b><a href="https://devbox.cn/p/StringTokenstrto_23839166.html" title="String Token strtok函数逻辑" target="_blank">String Token strtok函数逻辑</a> </li> <li> <b class="black">7</b><a href="https://devbox.cn/p/RuHeShiYong_char_e2e68eb3.html" title="如何使用chartjs绘制虚线?" target="_blank">如何使用chartjs绘制虚线?</a> </li> <li> <b class="black">8</b><a href="https://devbox.cn/p/YiLaiGuanXiMeiYo_8310ee37.html" title="依赖关系没有显示在Gradle的jar中吗?" target="_blank">依赖关系没有显示在Gradle的jar中吗?</a> </li> <li> <b class="black">9</b><a href="https://devbox.cn/p/-String-_He_Arra_8e77cc63.html" title="[String]和Array <String>之间的区别" target="_blank">[String]和Array <String>之间的区别</a> </li> <li> <b class="black">10</b><a href="https://devbox.cn/p/ShiMeShi_logits-_5fe95c08.html" title="什么是logits,softmax和softmax_cross_entropy_with_logits?" target="_blank">什么是logits,softmax和softmax_cross_entropy_with_logits?</a> </li> <li> <b class="black">11</b><a href="https://devbox.cn/p/--_MeiYouMingMin_feff98b7.html" title=""没有命名类型"简单程序错误" target="_blank">"没有命名类型"简单程序错误</a> </li> <li> <b class="black">12</b><a href="https://devbox.cn/p/ShiYong_Flask-Sq_565ff6e0.html" title="使用Flask + SqlAlchemy仅创建一个表" target="_blank">使用Flask + SqlAlchemy仅创建一个表</a> </li> <li> <b class="black">13</b><a href="https://devbox.cn/p/UWP_YeMianDaoHan_f710335e.html" title="UWP页面导航标识符" target="_blank">UWP页面导航标识符</a> </li> <li> <b class="black">14</b><a href="https://devbox.cn/p/-htaccess_ShiYon_7c361825.html" title=".htaccess使用GET参数重定向" target="_blank">.htaccess使用GET参数重定向</a> </li> <li> <b class="black">15</b><a href="https://devbox.cn/p/LiaoJieJingGao_-_7ea2d1a7.html" title="了解警告:将r值绑定到l值引用" target="_blank">了解警告:将r值绑定到l值引用</a> </li> <li> <b class="black">16</b><a href="https://devbox.cn/p/AnZhuang_VisualS_79ec9437.html" title="安装Visual Studio 2015时遇到困难(Microsoft Windows更新(KB2999226))" target="_blank">安装Visual Studio 2015时遇到困难(Microsoft Windows更新(KB2999226))</a> </li> <li> <b class="black">17</b><a href="https://devbox.cn/p/Zai_Swift_ZhongC_b88d8587.html" title="在Swift中创建随机Bool" target="_blank">在Swift中创建随机Bool</a> </li> <li> <b class="black">18</b><a href="https://devbox.cn/p/RuHeFanYingYuanS_5727ed5b.html" title="如何反应原生作品?" target="_blank">如何反应原生作品?</a> </li> <li> <b class="black">19</b><a href="https://devbox.cn/p/Python-_WuFaYong_de4ccd89.html" title="Python - 无法用"getenv("APPDATA")"找到"文件"?" target="_blank">Python - 无法用"getenv("APPDATA")"找到"文件"?</a> </li> <li> <b class="black">20</b><a href="https://devbox.cn/p/MVVM-_ChaKanDaoH_df18cc13.html" title="MVVM:查看导航无法正常工作" target="_blank">MVVM:查看导航无法正常工作</a> </li> </ul> </div> </div> </div> <div style="clear: both;"></div> </div> <script type="application/javascript"> function follow(uid) { var myDate = new Date(); $.get("/user/follow/post?uid="+uid+"&stime="+myDate.getMilliseconds(),null,function(response){ if(response=="1"){ tips('关注成功!') $("#follow_bt").html('<svg class="icon" style="width: 15px;height: 15px;margin-top:-3px;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1912"><path d="M984.554971 729.818319L757.2752 1001.934666c-23.431608 29.784785-63.349596 27.462118-91.084969 0l-148.309102-117.727323a34.156864 34.156864 0 0 1 34.156863-59.159688L711.732715 956.392181l224.524451-274.871667a34.156864 34.156864 0 1 1 48.297805 48.297805zM506.791534 592.052303c-6.284863 6.968-12.569726 0-22.771243 0-171.103115 0-386.928951 164.066802-386.928951 358.396584 0 18.740733-15.347817 33.951922-34.316262 33.951922a34.156864 34.156864 0 0 1-34.361805-33.951922c0-160.582801 134.122618-342.616113 323.283329-400.181814C261.271998 499.783228 210.765382 406.011252 210.765382 296.026151 210.765382 133.530566 342.428706 0 506.791534 0s296.026151 133.530566 296.026151 296.026151c0 161.630279-132.892971 294.614334-296.026151 296.026152z m0-523.738576c-126.243768 0-227.712424 102.903244-227.712424 227.712424s101.468656 227.712424 227.712424 227.712424 227.712424-102.903244 227.712424-227.712424S633.035302 68.313727 506.791534 68.313727z" p-id="1913"></path></svg>\n' +"已关注") }else if(response=="0"){ tips('已取消关注!') $("#follow_bt").html('<svg class="icon" style="width: 15px;height: 15px;margin-top:-3px;margin-right:5px;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1428"><path d="M1024 409.6H614.4V0H409.6v409.6H0v204.8h409.6v409.6h204.8V614.4h409.6z" fill="#ffffff" p-id="1429"></path></svg>\n' + "关注作者") }else if(response=="-2"){ tips("请先登录!") }else{ tips("关注失败!") } }); } function like(sid) { var myDate = new Date(); $.get("/blog/article/like?sid="+sid+"&stime="+myDate.getMilliseconds(),null,function(response){ if(response!="-1"){ $("#like_num").html(response+"赞") }else{ tips("关注失败!") } }); } </script> <div class="bottom-bar"> DevBox开发工具箱 | 专业的在线开发工具网站    <a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=11010802040832" style="color:#444;"><img src="https://img.json1.cn/3cd4a/21981/c5a/4df0b47476da9030.png"/>京公网安备 11010802040832号</a>  |  <a href="https://beian.miit.gov.cn/" target="_blank" >京ICP备19059560号-6</a> <BR /> Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有 <BR /> </div></body> </html>