Skip to main content

Finding values

To see if a Node with a specific name(s) is located within a parent, you can use the has method.

Command usage:

PYNdatabase.has(*names)
PYNdatabase.Node.has(*names)

If multiple names are entered, True will be returned only if the Node has ALL the names.

Examples:

Basic usage:

from pyndb import PYNDatabase
db = PYNDatabse('filename.pyndb')
db.set('hello', 'world')
db.set('helloagain', 'worldagain')
condition = db.has('hello')  # <-- (will equal True)
condition = db.has('test')  # <-- (will equal False)
condition = db.has('hello', 'helloagain') # <-- (will equal True)
condition = db.has('hello', 'test') # <-- (will equal False)