@@ -0,0 +1,1368 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A'%E7%AC%AC 0013 %E9%A2%98%EF%BC%9A %E7%94%A8 Python %E5%86%99%E4%B8%80%E4%B8%AA%E7%88%AC%E5%9B%BE%E7%89%87%E7%9A%84%E7%A8%8B%E5%BA%8F%EF%BC%8C%E7%88%AC%EF%BC%88http://tieba.baidu.com/p/2166231880%EF%BC%89%E5%9B%BE%E7%89%87 :-)'%0A%0A__author__ = 'Drake-Z'%0A%0Aimport os%0Aimport re%0Aimport urllib%0Afrom urllib import request%0Afrom urllib.request import urlopen%0A%0Adef read_url(yuanshiurl):%0A    req = request.Request(yuanshiurl)%0A    req.add_header('User-Agent', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; InfoPath.2; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; 360SE /360/ /chrome/ig)')%0A    with request.urlopen(req) as f:%0A        Imageurl(f.read().decode('utf-8'))                      #%E8%BE%93%E5%87%BAData%0A    return 0%0A%0Adef Imageurl(data):%0A    re_Imageurl = re.compile(r'src=%22(http://imgsrc.baidu.com/forum/.*?)%22')%0A    data = re_Imageurl.findall(data)                            #%E8%BE%93%E5%87%BA%E5%9B%BE%E7%89%87%E9%93%BE%E6%8E%A5%0A    downloadImage(data)%0A%0Adef downloadImage(tupianlianjie):%0A    dirct = '0013'%0A    try:  %0A        if not os.path.exists(dirct):                                   #%E5%88%9B%E5%BB%BA%E5%AD%98%E6%94%BE%E7%9B%AE%E5%BD%95%0A            os.mkdir(dirct)  %0A    except:  %0A        print('Failed to create directory in %25s' %25 dirct)%0A        exit()  %0A    for i in tupianlianjie:%0A        data = urllib.request.urlopen(i).read()  %0A        i = re.split('/', i)%5B-1%5D%0A        print(i)%0A        path = dirct + '/' +i%0A        f = open(path, 'wb')%0A        f.write(data)%0A        f.close()%0A    print('Done !')%0A%0Aurl = 'http://tieba.baidu.com/p/2166231880'%0Aread_url(url)

Add 0013 file