![]() key = value spaces in keys = allowed spaces in values = allowed as well spaces around the delimiter = obviously you can also use : to delimit keys from values values like this : 1000000 or this : 3.14159265359 are they treated as numbers? : no integers, floats and booleans are held as : strings can use the API to get converted values directly : true chorus : I'm a lumberjack, and I'm okay I sleep all night and I work all day key_without_value empty string value here = # like this or this # By default only in an empty line. Their own on an otherwise empty line, possibly indented. To change this, see ConfigParser.SECTCRE.Ĭonfiguration files may include comments, prefixed by specificĬharacters ( # and by default ). May be treated as parts of multiline values or ignored.īy default, a valid section name can be any string that does not contain ‘\n’. Depending on the parser’s mode, blank lines Values can also span multiple lines, as long as they are indented deeper In which case the key/value delimiter may also be left Values can be omitted if the parser is configured to allow it , ![]() Leading and trailing whitespace is removed from keys and values. By default, section names are case sensitive but keys are not getboolean ( 'BatchMode', fallback = True ) False Supported INI File Structure ¶Ī configuration file consists of sections, each led by a header,įollowed by key/value entries separated by a specific string ( = or : byĭefault ). getboolean ( 'BatchMode', fallback = True ) True > config = 'no' > topsecret. > 'BatchMode' in topsecret False > topsecret. ![]() Any conflicting keys are taken from the more recentĬonfiguration while the previously existing keys are retained. It is possible to read several configurations into a singleĬonfigParser, where the most recently added configuration has the Note also that keys in sections areĬase-insensitive and stored in lowercase. Involves the DEFAULT section which provides default values for all other print ( key ) user compressionlevel serveraliveinterval compression forwardx11 > config 'yes'Īs we can see above, the API is pretty straightforward. sections () > 'forge.example' in config True > '' in config False > config 'hg' > config 'yes' > topsecret = config > topsecret 'no' > topsecret '50022' > for key in config. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |