2022年7月26日
摘要: pip install pip -Upip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple# "pip install pip -U" 是用于执行升级pip的命令; 阅读全文
posted @ 2022-07-26 16:14 坚持_学习 阅读(363) 评论(0) 推荐(0) 编辑
摘要: uvloop #Python标准库中提供了asyncio模块,用于支持基于协程的异步编程。 #uvloop是 asyncio 中的事件循环的替代方案,替换后可以使得asyncio性能提高。事实上,uvloop要比nodejs、gevent等其他python异步框架#至少要快2倍,性能可以比肩Go语言 阅读全文
posted @ 2022-07-26 16:13 坚持_学习 阅读(77) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python# -*- coding:utf-8 -*-import aiofilesimport aiohttpimport asyncio#控制并发的数量sem = asyncio.Semaphore(3)async def fetch(session, url): 阅读全文
posted @ 2022-07-26 14:59 坚持_学习 阅读(49) 评论(0) 推荐(0) 编辑
摘要: # -*- coding:utf-8 -*-import asyncioimport aiofilesimport time#异步操作时,函数名前必须加上asyncasync def func1(): #异步写入文件 async with aiofiles.open("text.txt","a",e 阅读全文
posted @ 2022-07-26 13:52 坚持_学习 阅读(1445) 评论(0) 推荐(0) 编辑