06 2024 档案
摘要:尝试想要写自己的自动化测试框架,使用的是flask,想要使用SQLAlchemy实现数据库的模型映射,但是按照官方文档创建好module后执行时,会报错Working outside of application context. 经过一番查找,存在flask的上下文问题,以下是解决过程 官网案例:
阅读全文
摘要:# __import__是import语句的底层实现,解释器用的,是Python早期用于动态导入模块的函数, # 而importlib模块是在Python 3中引入的,提供了更丰富的API来处理模块导入相关的操作。 import importlib from importlib import uti
阅读全文
摘要:以下内容转载于 【python的importlib模块】 https://cloud.tencent.com/developer/article/1496629 1 模块简介 Python提供了importlib包作为标准库的一部分。目的就是提供Python中import语句的实现(以及__impo
阅读全文
摘要:def get_project_tree(start_path: str, original_path: str, tree_data:list): child_files = os.listdir(start_path) for child_file in child_files: if chil
阅读全文