上一页 1 2 3 4 5 6 ··· 11 下一页
摘要: from threading import Thread,Semaphore import time,random sm=Semaphore(5) def task(name): sm.acquire() print('%s 正在上厕所' %name) time.sleep(random.randi 阅读全文
posted @ 2020-09-10 22:28 xuqidong 阅读(125) 评论(0) 推荐(0) 编辑
摘要: ''' 1. 什么是生产者消费者模型 生产者:代指生产数据的任务 消费者:代指处理数据的任务 该模型的工作方式: 生产生产数据传递消费者处理 实现方式: 生产者 >队列< 消费者 2. 为何要用 当程序中出现明细的两类任务,一类负责生产数据,一类负责处理数据 就可以引入生产者消费者模型来实现生产者与 阅读全文
posted @ 2020-09-10 22:25 xuqidong 阅读(136) 评论(0) 推荐(0) 编辑
摘要: string = 'aabbccddee1234AZDEDFASFSF.,$%#@#$^*KMza1235+)(' c_map = {} for v in string: c_map.setdefault(v, 0) c_map[v] += 1 print(c_map) 阅读全文
posted @ 2020-09-09 21:58 xuqidong 阅读(188) 评论(0) 推荐(0) 编辑
摘要: import os if __name__ == '__main__': os.environ.setdefault("DJANGO_SETTINGS_MODULE", "day77.settings") import django django.setup() from app01.models 阅读全文
posted @ 2020-09-08 22:50 xuqidong 阅读(123) 评论(0) 推荐(0) 编辑
摘要: seq -w 10|sed -r "s#(.*)#useradd oldboy\1;echo 123456|passwd --stdin oldboy\1#g"|bash ip a s eth0|egrep "([0-9]+\.?){4}" -o|head -3|tail -1 find ./ -m 阅读全文
posted @ 2020-09-06 23:00 xuqidong 阅读(151) 评论(0) 推荐(0) 编辑
摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <link rel="stylesheet" href="/static/bs/dist/css/bootstrap.css"> < 阅读全文
posted @ 2020-09-06 17:45 xuqidong 阅读(121) 评论(0) 推荐(0) 编辑
摘要: import time import queue import random import threading import requests class V2ProxyItem(object): USER_AGENT_LIST = [ "Mozilla/5.0 (Windows NT 6.1; W 阅读全文
posted @ 2020-09-03 23:25 xuqidong 阅读(164) 评论(0) 推荐(0) 编辑
摘要: """ Django settings for swiper project. Generated by 'django-admin startproject' using Django 1.11.15. For more information on this file, see https:// 阅读全文
posted @ 2020-09-02 22:49 xuqidong 阅读(107) 评论(0) 推荐(0) 编辑
摘要: # 单例模式:多次实例化的结果指向同一个实例 # 单例模式实现方式一: ''' import settings class MySQL: __instance=None def __init__(self, ip, port): self.ip = ip self.port = port @clas 阅读全文
posted @ 2020-09-01 23:43 xuqidong 阅读(83) 评论(0) 推荐(0) 编辑
摘要: ''' from concurrent.futures import ThreadPoolExecutor,ProcessPoolExecutor import time,random,os def task(name,n): print('%s%s is running' %(name,os.ge 阅读全文
posted @ 2020-08-31 22:59 xuqidong 阅读(88) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 11 下一页