摘要: import multiprocessing,timedef down_load(): time.sleep(5) print("运行完了")if __name__ == '__main__': for i in range(5): p = multiprocessing.Process(targe 阅读全文
posted @ 2019-11-19 23:08 一只竹子 阅读(124) 评论(0) 推荐(0) 编辑
摘要: #多个线程操作同一个数据的时候,就得加锁import threadingnum = 0lock = threading.Lock()#申请一把锁def add(): global num lock.acquire()#加锁 num+=1 lock.release()#解锁for i in range 阅读全文
posted @ 2019-11-19 23:05 一只竹子 阅读(129) 评论(0) 推荐(0) 编辑
摘要: import threading,timedef down_load(): time.sleep(5) print("运行完了")for i in range(10): t = threading.Thread(target=down_load) t.setDaemon(True)#设置子线程为守护 阅读全文
posted @ 2019-11-19 23:00 一只竹子 阅读(84) 评论(0) 推荐(0) 编辑
摘要: import requestsfrom hashlib import md5import threadingimport timedef down_load_pic(url): req= requests.get(url) m = md5(url.encode()) with open(m.hexd 阅读全文
posted @ 2019-11-19 22:56 一只竹子 阅读(191) 评论(0) 推荐(0) 编辑
摘要: import threadingimport time#进程是多个资源的集合#线程是进程里面具体干活的#线程和线程之间是互相独立的start_time = time.time()def down_load(): time.sleep(5) print("运行完了")for i in range(10 阅读全文
posted @ 2019-11-19 22:55 一只竹子 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 实例化的对象是谁,self就是谁 阅读全文
posted @ 2019-11-19 22:53 一只竹子 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 更改项目地址环境 阅读全文
posted @ 2019-11-17 14:46 一只竹子 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 1、面向对象 类:一个模型,一个图纸。 对象:根据模型做出来的东西就是实例。 实例:实例和对象是一回事。 实例化:就是根据模型做具体东西的过程。 self:本类对象。 继承: 私有方法、私有变量不会被继承 1、如果要在父类方法的基础上重写扩展功能,super().xxx调用父类,然后把 对应的参数, 阅读全文
posted @ 2019-11-16 22:47 一只竹子 阅读(173) 评论(0) 推荐(0) 编辑
摘要: ValueError: urls must start with a leading slash 这个错误是因为 server.route('/api/get_bill')括号中的内容,缺少‘/’ 阅读全文
posted @ 2019-11-09 13:49 一只竹子 阅读(1314) 评论(0) 推荐(0) 编辑
摘要: import flaskimport jsonimport tools#mock接口开发 挡板#1、模拟第三方接口#2、 给别人提供数据#3、flask是一个web开发框架server = flask.Flask(__name__)@server.route('/api/login',methods 阅读全文
posted @ 2019-11-09 11:06 一只竹子 阅读(1596) 评论(0) 推荐(0) 编辑