Skip to content

Instantly share code, notes, and snippets.

@FurryHead
Created June 27, 2011 16:24
Show Gist options
  • Save FurryHead/1049213 to your computer and use it in GitHub Desktop.
Save FurryHead/1049213 to your computer and use it in GitHub Desktop.
ConfigParser test ini file
; This is a comment
# This is also a comment
; This is a variable defined outside a section,
; you can access _these_ by using section name "DEFAULT"
; (Note: "DEFAULT" doesn't appear when you use ConfigParser.sections();)
foo = bar
[ freenode ] ;This is a section, leading/trailing whitespace trimmed, always enclosed by [ ]
host = irc.freenode.net ;This is a unquoted variable
port : 6667
nick : "PlugBot" ;This is a quoted variable
ident=PlugBot2
identify={ident} ;This is referencing a previously defined variable
; Variables can be referenced even from within strings
test = "Server port is {port}"
test2 = Server is {host}
test3 = 'Server is at {host}:{port}'
;Referencing a previous variable produces it's contents,
; or if the variable is not defined, it produces ""
;All leading/trailing whitespace gets trimmed,
;So using (without quotes) 'nick = fooo ', 'nick' = 'foo'
;but if you quote the value, 'nick = " for "', it
;preserves the whitespace
;(this also applies to key names)
;This is another section
[freenodetr]
;Another quoted variable
server = "Hello, world!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment