Python 实现异步调用函数
Python,实现,异步,调用函数
2025-04-07 09:01:30 时间
大家好,又见面了,我是你们的朋友全栈君。
async_call.py
#coding:utf-8
from threading import Thread
def async_call(fn):
def wrapper(*args, **kwargs):
Thread(target=fn, args=args, kwargs=kwargs).start()
return wrapper
test.py
from time import sleep
from async_call import async_call
class AA:
@async_call
def hello( self ):
self.__count += 1
print(int(time.()))
sleep(2)
print(int(time.()))
return
if __name__ == "__main__":
AA().hello()
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/157350.html原文链接:https://javaforall.cn
相关文章
- python常见的数据类型有哪些?
- Python 基于 selenium 实现不同商城的商品价格差异分析系统
- [Python] 使用print作进度条(解决end=''时print不显示的问题)
- python copy&deepcopy
- Anaconda 查看、创建、管理和使用python环境
- python微信自动群发脚本_python 微信批量发送消息脚本
- python encode和decode函数说明[通俗易懂]
- Python || 皖事通安康码截图信息简易识别采集
- python getopt方法_python的getopt
- python中替换字符串中字符_Python replace()函数:替换字符串中的某个字符「建议收藏」
- python中astype 存在空值_python-DataFrame.astype()错误参数
- Python日志管理
- Python实现AI视频识别——手势控制[通俗易懂]
- python换行符使用_python中怎么换行?「建议收藏」
- 剑指offer:Python 二进制中1的个数 &0xffffffff是什么意思?
- Python模拟一个用户登录系统
- Python基础23-SSH模块paramiko
- 多重共线性:python计算VIF以及使用vif做因子独立性检验的方法「建议收藏」
- Python-基础01-变量
- 用Python画个生日蛋糕为朋友庆生