unittest (22) - p2p project combat (4) -read_config

 

# 4. read_config.py 

Import ConfigParser 


class readconfig: 
    @staticmethod 
    DEF get_config (file_path, sectionTop, Option): 
        CF2 = configparser.ConfigParser ()   # instantiate an object 
        cf.read (file_path)   # reads the configuration file 
        return CF2 [sectionTop ] [Option]   # returns CI 


IF  the __name__ == ' __main__ ' :
     from Tools Import project_path
     Print (ReadConfig.get_config (project_path.case_config_path, " the MODE " ,"mode"))

 

Guess you like

Origin www.cnblogs.com/come202011/p/12232191.html