I use a list as part of a Python program, and wanted to convert that to an environment variable.
So, it\'s like this:
list1 = [\'a.1\',\'b.2\',\'c.3\']
I recommend using JSON if you want to have data structured in an environment variable. JSON is simple to write / read, can be written in a single line, parsers exist, developers know it.
To test, execute this in your shell:
$ export ENV_LIST_EXAMPLE='["Foo", "bar"]'
Python code to execute in the same shell:
import os
import json
env_list = json.loads(os.environ['ENV_LIST_EXAMPLE'])
print(env_list)
print(type(env_list))
gives
['Foo', 'bar']
Chances are high that you are interested in cfg_load