0

I am a new programmer working on a program that contains a list of recipes which can be searched and then generate menu from a selected commonality.

My initial thought has been to use a configuration file to store the data (I am using configobj for python). The problem here is that a value (e.g. ingredients = []) will occur several times.

Is there a way to separate different configurations within a single file? something like

Recipe
{
    value0 = 
}
Recipe 2
{
    value0 =
}

I am trying to avoid having ascending values (value1(n),value1(n+1)) or using a config file for each recipe.

Alternatively if this is not possible, could someone suggest an alternative file structure, including those not using configobj.

Bishan
  • 15,211
  • 52
  • 164
  • 258
Revots
  • 27
  • 6

1 Answers1

0

If you want human-editable ini-like format:

[Recipe]
value0 = ..

[Recipe2]
value0 = ..

If the file is used to exchange data between programs then you could use (also human-readable) json format:

{ "Recipe": { "value0": ".." }, "Recipe2": { "value0": ".." } }
jfs
  • 399,953
  • 195
  • 994
  • 1,670
  • Thank you for your answer, the first is what I am looking for. I believe those headers are called sections. – Revots Jan 02 '13 at 00:30