I've provided the code below. I'm just wondering if there's a better, more concise, way to load the entire index into variables, instead of manually specifying each one...
Python code
script_dir = os.path.dirname(__file__)
file_path = os.path.join(script_dir, 'config.yaml')
with open(file_path, 'r') as stream:
index = 'two'
load = yaml.load(stream)
USER = load[index]['USER']
PASS = load[index]['PASS']
HOST = load[index]['HOST']
PORT = load[index]['PORT']
...
YAML Config
one:
USER: "john"
PASS: "qwerty"
HOST: "127.0.0.1"
PORT: "20"
two:
USER: "jane"
PASS: "qwerty"
HOST: "196.162.0.1"
PORT: "80"