Examples


Using PyVDF

import PyVDF
vdf = PyVDF()

Read a File

# Class Methods
vdf = PyVDF(infile='/path/to/file')
value = vdf['Path.to.Key']

# Static Methods
vdf = PyVDF.read('/path/to/file')
value = vdf['Path']['to']['Key']

Read a String

food = '''
"Apple"
{
    "Pie"    "Good"
    "Cobbler"    "Great"
}'''

# Class Methods
vdf = PyVDF(data=food)
value = vdf['Apple.Pie']

# Static Methods
vdf = PyVDF.reads('/path/to/file')
value = vdf['Apple']['Pie']

Find Multiple Values

vdf.findMany(['Apple.Pie', 'Apple.Cobbler'])
"['Good','Great']"

Edit Multiple Values

vdf.editMany([('Apple.Pie','Pumpkin'),
              ('Apple.Cobbler', 'Pie')])