mirror of
https://github.com/hlt1995/qlScripts.git
synced 2026-11-06 15:46:43 +08:00
24 lines
597 B
Python
24 lines
597 B
Python
# -*- coding=UTF-8 -*-
|
|
# @Project QL_TimingScript
|
|
# @fileName get_env.py
|
|
# @author Echo
|
|
# @EditTime 2024/11/26
|
|
import os
|
|
import re
|
|
|
|
from dotenv import load_dotenv, find_dotenv
|
|
|
|
from fn_print import fn_print
|
|
|
|
|
|
def get_env(env_var, separator):
|
|
if env_var in os.environ:
|
|
return re.split(separator, os.environ.get(env_var))
|
|
else:
|
|
load_dotenv(find_dotenv())
|
|
if env_var in os.environ:
|
|
return re.split(separator, os.environ.get(env_var))
|
|
else:
|
|
fn_print(f"未找到{env_var}变量.")
|
|
return []
|