microproduct/deformation-sentiral/ConfigeHandle.py

35 lines
879 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# -*- coding: UTF-8 -*-
"""
@Project onestar
@File ConfigeHandle.py
@Contacthttps://blog.csdn.net/songlh1234/article/details/83316468
@Author SHJ
@Date 2021/11/23 16:57
@Version 1.0.0
"""
import os
import configparser
class Config:
"""读写初始化配置文件"""
def __init__(self):
pass
@staticmethod
def get(para_name, option='config', config_name = 'config.ini'):
config = configparser.ConfigParser()
config_path = os.path.join(os.getcwd(), config_name)
config.read(config_path, encoding='utf-8')
config.sections()
exe_name = config.get(option, para_name)
return exe_name
if __name__ == '__main__':
# c = Config()
# a = c.get('exe_name')
# b = bool(c.get('debug'))
# d = int(c.get('cover_threshold'))
# f = float(c.get('ndvi_threshold'))
print('done')