Keep ConfigParser output files sorted

前端 未结 4 855
旧巷少年郎
旧巷少年郎 2021-01-05 10:15

I\'ve noticed with my source control that the content of the output files generated with ConfigParser is never in the same order. Sometimes sections will change place or opt

4条回答
  •  情深已故
    2021-01-05 10:38

    No. The ConfigParser library writes things out in dictionary hash order. (You can see this if you look at the source code.) There are replacements for this module that do a better job.

    I will see if I can find one and add it here.

    http://www.voidspace.org.uk/python/configobj.html#introduction is the one I was thinking of. It's not a drop-in replacement, but it is very easy to use.

提交回复
热议问题