0

Is there any standard for python configuration files? What I would like to have is a seperate document to my script which would have the options of my script in it. For example...

Test Options
Random_AOI      = 1
Random_ReadMode = 1

These would then become a list within the python script, such as...

test_options(random_aoi, random_readmode)

Would I have to use regular expressions and scan the document or is there an easier way of performing this action?

2 Answers 2

2

Yes - there's ConfigParser, which parses .ini files.

There's a handy introduction to it here.

Sign up to request clarification or add additional context in comments.

Comments

1

The "standard" config file formats for Python are INI (which you parse/write with the ConfigParser module -- http://docs.python.org/2/library/configparser.html) and JSON (http://docs.python.org/2/library/json.html).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.