Last active
January 14, 2018 20:04
-
-
Save stuaxo/a6af1cda64e7ae04a214efc8e10ff877 to your computer and use it in GitHub Desktop.
http://buklijas.info simple solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"[other]\r\n", | |
"list_queue1 = 192.168.1.34 192.168.1.35 192.168.1.36 192.168.1.34\r\n" | |
] | |
} | |
], | |
"source": [ | |
"!cat config_ini.ini" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 34, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"['192.168.1.34', '192.168.1.35', '192.168.1.36', '192.168.1.34']\n" | |
] | |
} | |
], | |
"source": [ | |
"import ConfigParser\n", | |
"import io\n", | |
"import shlex\n", | |
"\n", | |
"def main():\n", | |
" config = ConfigParser.ConfigParser(allow_no_value=True)\n", | |
" config.read('config_ini.ini')\n", | |
" testing_1 = shlex.split(config.get('other', 'list_queue1'))\n", | |
" print(testing_1)\n", | |
" \n", | |
"if __name__ == '__main__':\n", | |
" main()" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 2", | |
"language": "python", | |
"name": "python2" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 2 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython2", | |
"version": "2.7.14" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment