79766328

Date: 2025-09-16 14:20:20
Score: 0.5
Natty:
Report link

As per the documentation, there is an init parameter allow_unnamed_section.

So your example can be implemented as following:

import configparser
cp = configparser.ConfigParser(allow_unnamed_section=True)
cp.read("rsyncd.conf")
path = cp.get(configparser.UNNAMED_SECTION, 'path') # read a value
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: pas-calc