Python模块之tool.read_config-读配置文件

tool.read_config

作用:

  增、删、改、查、数据库内容。

必要操作:

1
2
>>> from tool.read_config import ReadConfig
>>> from tool import project_path

  

帮助查看:

1
>>> help(tool)

  或 单独查看某个方法(函数)

1
>>> help(tool.read_config)

  

方法(函数):

1
2
3
4
5
#read_config文件中ReadConfig是静态方法,不用实例化
        db_config = eval(ReadConfig.get_config(project_path.case_config_path,"DB","db_config"))
        print(db_config)
        #关键字参数传递
        cnn = pymysql.connect(**db_config)

  

 

参考:

https://www.jianshu.com/p/e266137ebca0

posted @   悟透  阅读(182)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
点击右上角即可分享
微信分享提示