Python os.environ方法代码(精选详情)
本文整理汇总了后端语言 Python中os.environ方法的典型用法代码示例。这里精选的方法代码示例或许可以为您提供帮助。如果想了解web前端的内容,如html,css,Javascript示例,可以点击相关链接,大量实战实例示例1: get_settings1234567891011121314151617181920# 需要导入模块: import os [as 别名]# 或者: from os import environ [as 别名]def get_settings(self):"""Return the DynamoDB aws-auto-remediate-settings table in a Python dict formatReturns:dict -- aws-auto-remediate-settings table"""settings = {}try:for record in boto3.client("dynamodb").scan(TableName=os.environ["SETTINGSTABLE"])["Items"]:record_json = dynamodb_json.loads(record, True)settings[record_json["key"]] = record_json["value"]except:self.logging.error(f"Could not read DynamoDB table '{os.environ['SETTINGSTABLE']}'.")self.logging.error(sys.exc_info()[1])return settings示例2: __init__12345678910111213141516171819202122# 需要导入模块: import os [as 别名]# 或者: from os import environ [as 别名]def __init__(self, methodName, prop_file="models/grid_for_test.props"):super().__init__(methodName=methodName)self.pa = props.read_props(MODEL_NM, prop_file)# Now we create a forest environment for our agents to act within:if self.pa["user_type"] == props.WEB:self.pa["base_dir"] = os.environ["base_dir"]# Now we create a minimal environment for our agents to act within:self.env = ge.GridEnv("Test grid env",self.pa["grid_width"],self.pa["grid_height"],torus=False,model_nm=MODEL_NM,preact=True,postact=True,props=self.pa)for i in range(self.pa["num_agents"]):self.env.add_agent(gm.TestGridAgent(name="agent" + str(i),goal="taking up a grid space!"))self.env.add_agent(gm.TestGridAgent(name="agent for tracking",goal="taking up a grid space!"))