摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" http-equiv="refresh" content="2;URL=http://www.baidu.com"> <!--定义网页源信息,2秒后跳转页面--> <meta 阅读全文
posted @ 2021-02-17 13:37 丑矬穷屌 阅读(53) 评论(0) 推荐(0)
摘要: import pymysql conn=pymysql.connect( host='127.0.0.1', port=3306, user='root', password='999', database='day14', charset='utf8', autocommit=1 #自动提交,不设 阅读全文
posted @ 2021-02-15 22:35 丑矬穷屌 阅读(71) 评论(0) 推荐(0)
摘要: from gevent import monkey;monkey.patch_all()import timefrom gevent import spawndef pp(): print('ppstar') time.sleep(2) print('ppover')def oo(): print( 阅读全文
posted @ 2021-02-02 18:27 丑矬穷屌 阅读(72) 评论(0) 推荐(0)
摘要: from threading import Thread,Eventimport timeevent=Event()def wait(): print('wait==') time.sleep(2) print('over!') event.set()def go(i): print(f'{i},Z 阅读全文
posted @ 2021-02-02 18:02 丑矬穷屌 阅读(219) 评论(0) 推荐(0)
摘要: from threading import Thread,Semaphore #类似锁的一个东西import timelock_num=Semaphore(2) #设置锁的数量def test(name): lock_num.acquire() print(f'{name}已加入') time.sl 阅读全文
posted @ 2021-02-02 17:52 丑矬穷屌 阅读(76) 评论(0) 推荐(0)
摘要: from concurrent.futures import ThreadPoolExecutor,ProcessPoolExecutorimport timedef func(i): print('star', i) time.sleep(2) return f'over,{i}'def cb(r 阅读全文
posted @ 2021-02-02 12:27 丑矬穷屌 阅读(82) 评论(0) 推荐(0)
摘要: import socketfrom threading import Threadserver = socket.socket(socket.AF_INET,socket.SOCK_STREAM)server.bind(('127.0.0.1',8080))server.listen(5)# def 阅读全文
posted @ 2021-02-01 00:22 丑矬穷屌 阅读(85) 评论(0) 推荐(0)
摘要: from multiprocessing import Process,JoinableQueueimport randomimport timedef fang(jq,ll): for i in range(3): ran=random.randint(1,3) name=random.choic 阅读全文
posted @ 2021-01-31 21:47 丑矬穷屌 阅读(131) 评论(0) 推荐(0)
摘要: from multiprocessing import Queue,Processdef fang(queue): queue.put('你愁啥')def qu(queue): print(queue.get())if __name__ == '__main__': q=Queue() p_fang 阅读全文
posted @ 2021-01-31 20:51 丑矬穷屌 阅读(91) 评论(0) 推荐(0)
摘要: from multiprocessing import Queueq = Queue(3)q.put('aaa')q.put('bbb')q.put('ccc')print(q.full()) #判断当前队列是否已满print(q.empty()) #判断队列是否为空a = q.get()b = q 阅读全文
posted @ 2021-01-31 20:38 丑矬穷屌 阅读(47) 评论(0) 推荐(0)