1 Star 0 Fork 0

xyislove/python-test

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
异步与同步读取文件的区别-异步.py 330 Bytes
一键复制 编辑 原始数据 按行查看 历史
xyislove 提交于 2021-12-19 21:08 . 2021.12.19
import aiofiles
import asyncio
async def fun1():
async with aiofiles.open('1.text',mode='r') as f:
async for line in f:
print(line)
async def fun2():
async with aiofiles.open('1.text',mode='a') as f:
f.write('fuck u!!')
print('写入完成')
asyncio.run(fun1())
asyncio.run(fun2())
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xyislove/python-test.git
git@gitee.com:xyislove/python-test.git
xyislove
python-test
python-test
master

搜索帮助