This commit is contained in:
guanjihuan 2025-03-20 05:25:16 +08:00
parent 4a806dfc6f
commit 6ec38a3e08
3 changed files with 11 additions and 2 deletions

View File

@ -1,7 +1,7 @@
[metadata]
# replace with your username:
name = guan
version = 0.1.167
version = 0.1.168
author = guanjihuan
author_email = guanjihuan@163.com
description = An open source python package

View File

@ -1,6 +1,6 @@
Metadata-Version: 2.4
Name: guan
Version: 0.1.167
Version: 0.1.168
Summary: An open source python package
Home-page: https://py.guanjihuan.com
Author: guanjihuan

View File

@ -86,6 +86,15 @@ def run(function_name, *args, **kwargs):
pass
return return_data
# 使用该函数获取函数计算时间(秒)
def timer(function_name, *args, **kwargs):
import time
start = time.time()
result = function_name(*args, **kwargs)
end = time.time()
print(f"Running time of {function_name.__name__}: {end - start} seconds")
return result
# 使用该函数实现 try except 结构
def try_except(function_name, *args, **kwargs):
try: