How can I use model 'config'? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I use model 'config'?

28th Jun 2018, 8:35 PM
Rualex Ru
Rualex Ru - avatar
7 Answers
+ 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!
28th Jun 2018, 8:49 PM
David Gedalia Ordman
David Gedalia Ordman - avatar
+ 1
explain
28th Jun 2018, 8:42 PM
David Gedalia Ordman
David Gedalia Ordman - avatar
28th Jun 2018, 8:49 PM
David Gedalia Ordman
David Gedalia Ordman - avatar
0
What about arguments?
28th Jun 2018, 8:44 PM
Rualex Ru
Rualex Ru - avatar
0
I'm quoting a website
28th Jun 2018, 8:48 PM
David Gedalia Ordman
David Gedalia Ordman - avatar
0
nice thanks a lot
28th Jun 2018, 8:51 PM
Rualex Ru
Rualex Ru - avatar
0
np
28th Jun 2018, 9:29 PM
David Gedalia Ordman
David Gedalia Ordman - avatar