在Python3中异步删除文件的最佳方法? [英] Best way to delete a file asynchronously in Python3?

查看:90
本文介绍了在Python3中异步删除文件的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几(4)年前的帖子显示了如何使用线程异步删除文件.

事情已经发生了变化,例如aiofiles等.这一切都有点迷宫,所以我错过了一种当前的,优雅的方法来实现这一点而无需线程化吗?

解决方案

没有线程就无法异步处理文件I/O aiofiles 库用法./p>

There are posts from several (4) years ago showing how to use Threads to delete a file asynchronously.

Things have moved on though, what with aiofiles etc. Its all a bit of a maze, so am I missing a current, elegant method to achieve this without Threading ??

解决方案

There's no way to work with file I/O asynchronously without threads due to operation systems limits. It's not related to Python or asyncio at all.

The best way to work with file I/O asynchronously now - is aiofiles library usage.

这篇关于在Python3中异步删除文件的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆