When I looked it up, I thought, and I couldn't find an article in Japanese.
I write it in a solid array.
[Foo]
fibs: [1,1,2,3,5,8,13]
The following is also possible.
[Foo]
fibs = [1,1,2,3,5,8,13]
If you read it with ConfigParser and process it with json.loads as it is, it will be an array.
import configparser
import json
config_ini = configparser.ConfigParser()
config_ini.read("config.ini", encoding='utf-8')
arr = json.loads(config.get("Foo","fibs"))
print(arr) # [1, 1, 2, 3, 5, 8, 13]
It was possible not only with numerical values but also with character strings.
Recommended Posts