华为云的使用和数据库的交流


一 数据库交流

1.1 创建多级目录

os.makedirs("./config/", exist_ok=True)

1.2 pandas中的Series获取里边的值

r.values[0]      # 获取内部数据

1.3 logging日志的使用

1.4 JSON变量导入

通过 config. 变量进行调取

class Config:
    def __init__(self, config_file):
        with open(config_file, 'r') as f:
            config_dict = json.load(f)
        self.sludge_area = config_dict['sludge_area'] # 单个排泥池面积
        self.t0_hour = config_dict['t0_hour']  # 目标时
        self.t0_minute = config_dict['t0_minute']  # 目标分

config = Config('./config/config.json')

# 取json中的变量: config.t0_hour
t0 = datetime(t.year, t.month, t.day, config.t0_hour, config.t0_minute)

猜你喜欢

转载自blog.csdn.net/March_A/article/details/129895680
今日推荐