Domanda

Games from Valve use following data format

"name1"
{
    "name2"  "value2"
    "name3"
    {
        "name4" "value4"
    }
}

Does this format have a name or is it just self made?

Can I parse it in python?

È stato utile?

Soluzione

I'm not sure that it has a name, but it seems very straightforward: a node consists of a key and either a value or a set of values that are themselves either plain strings or sets of key-value pairs. It would be trivial to parse recursively, and maps cleanly to a structure of nested python dictionaries.

Altri suggerimenti

Looks like their own format, called Valve Data Format. Documentation here, I don't know if there is a parser available in python, but here is a question about parsing it in php

Looks a lot like JSON without comma and colon seperators. You could parse it manually since it has the same logic to it.

Seems to consist of name-value pairs, so after a name, finding a '{' or another string in "" would mean a value.

A composite structure of custom classes would make it easy to handle. As Matti John linked, there is documentation.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top