4 ms·
The first complexity in the ConfigParser example comes from trying to parse something like a python list. Just accept ips seperated by spaces, users will be th
by stuaxo 9y ago
The first complexity in the ConfigParser example comes from trying to parse something like a python list.
Just accept ips seperated by spaces, users will be thankful.
The other complexity is using the raw loading and converting from bytes.
ConfigParser can give you back strings and read the file for you.
Here is a full example:
import ConfigParser
import io
import shlex
def main():
config = ConfigParser.ConfigParser(allow_no_value=True)
config.read('config_ini.ini')
testing_1 = shlex.split(config.get('other', 'list_queue1'))
print(testing_1)
if __name__ == '__main__':
main()
This is the same as a comment I made on the website, but for the benefit of any python devs here.