Lists in ConfigParser

后端 未结 15 2048
清酒与你
清酒与你 2020-11-27 09:38

The typical ConfigParser generated file looks like:

[Section]
bar=foo
[Section 2]
bar2= baz

Now, is there a way to index lists like, for in

15条回答
  •  天命终不由人
    2020-11-27 10:05

    There is nothing stopping you from packing the list into a delimited string and then unpacking it once you get the string from the config. If you did it this way your config section would look like:

    [Section 3]
    barList=item1,item2
    

    It's not pretty but it's functional for most simple lists.

提交回复
热议问题