0.1.168
This commit is contained in:
		| @@ -1,7 +1,7 @@ | |||||||
| [metadata] | [metadata] | ||||||
| # replace with your username: | # replace with your username: | ||||||
| name = guan | name = guan | ||||||
| version = 0.1.167 | version = 0.1.168 | ||||||
| author = guanjihuan | author = guanjihuan | ||||||
| author_email = guanjihuan@163.com | author_email = guanjihuan@163.com | ||||||
| description = An open source python package | description = An open source python package | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| Metadata-Version: 2.4 | Metadata-Version: 2.4 | ||||||
| Name: guan | Name: guan | ||||||
| Version: 0.1.167 | Version: 0.1.168 | ||||||
| Summary: An open source python package | Summary: An open source python package | ||||||
| Home-page: https://py.guanjihuan.com | Home-page: https://py.guanjihuan.com | ||||||
| Author: guanjihuan | Author: guanjihuan | ||||||
|   | |||||||
| @@ -86,6 +86,15 @@ def run(function_name, *args, **kwargs): | |||||||
|         pass |         pass | ||||||
|     return return_data |     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 结构 | # 使用该函数实现 try except 结构 | ||||||
| def try_except(function_name, *args, **kwargs): | def try_except(function_name, *args, **kwargs): | ||||||
|     try: |     try: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user