Copyright © 2015 by DKY (Ryan Lam)
VDFUtils is a Python utility library that provides the ability to parse and format data in Valve Data Format ("VDF", otherwise known as "Valve KeyValues Format").
Current version: 3.0.1
- Python 2.7
The two main functions that are provided by VDFUtils are parse_vdf() and format_vdf(). parse_vdf() is used to convert a VDF-formatted string into a Python OrderedDict, and format_vdf() is used to convert a Python dict into a VDF-formatted string.
inData- A VDF-formatted string.allowRepeats(default:False) - If this isTrue, duplicate keys in the VDF data will be collected into a list representing all of the keys' values. Otherwise, duplicate keys that occur later in the data will overwrite earlier keys.escape(default:True) - If this isTrue, the following special character sequences will be escaped and replaced with their character equivalents:\\,\n,\t,\". Otherwise, these character sequences are interpreted literally.
- A Python
OrderedDictrepresenting the parsed VDF data.
VDFConsistencyError- Raised if the VDF data cannot be parsed.
Takes dictonary data and returns a string representing that data in VDF format. If this cannot be done, raises VDFSerializationError.
data- Any Pythondict.escape(default:True) - If this isTrue, all backslashes, newlines, tabs, and double quotes will be escaped and replaced with their escape sequence equivalents:\\,\n,\t,\". Otherwise, the affected characters are directly inserted into the VDF-formatted data.
- A string representing the serialized data in VDF format.
VDFSerializationError- Raised if the data cannot be serialized.