Nov-28-2019, 07:03 AM
(This post was last modified: Nov-29-2019, 07:58 AM by Gribouillis.)
If I understand the question well, you want to read the paths to the sockets in an external file. You can use a configuration file for this and the configparser module
Output:# configuration-file.ini
[spam]
sockets: /var/run/haproxy-main-hello.sock
/var/run/haproxy-main-hello1.sock
Your programimport configparser config = configparser.ConfigParser() config.read('configuration-file.ini') sockets = config.get('spam', 'sockets').split('\n')