So I have a key value file that's similar to JSON's format but it's different enough to not be picked up by the Python JSON parser.
Example:
"Matt"
{
"Location" "New York"
"Age" "22"
"Items"
{
"Banana" "2"
"Apple" "5"
"Cat" "1"
}
}
Is there any easy way to parse this text file and store the values into an array such that I could access the data using a format similar to Matt[Items][Banana]? There is only to be one pair per line and a bracket should denote going down a level and going up a level.
len(line.split("\t")), length of 1 means an object coming up as value of a key next few lines, length of 2 means a simple key-value pair of literals, while matching braces can define the object boundary for you. Write an iterative/recursive parser based on this should work, but it's a lot more trouble than using an existing parser. I don't wanna write it for you :D