+ 1
How can I use model 'config'?
7 odpowiedzi
+ 2
The simplest scenario is, of course, “Hello, world”. Let’s look at a very simple configuration file simple.cfg where a message to be printed is configured:
# The message to print (this is a comment)
message: 'Hello, world!'
and the program which uses it:
from config import Config
# You can pass any file-like object; if it has a name attribute,
# that name is used when file format error messages are printed
f = file('simple.cfg')
cfg = Config(f)
print cfg.message
which results in the expected:
Hello, world!
+ 1
explain
0
What about arguments?
0
I'm quoting a website
0
nice thanks a lot
0
np