Skip to main content

Dictionary Navigator With Strings

Project description

Python Dictionary Navigator

Quick Start

To install, use pip:

pip install -U dictionay_navigator

Usage

>>> from dictionary_navigator import navigator
>>> myDict = {
        'person': {
            'name': {
                'first': 'Michael',
                'las': 'Scott'
            },
            'height': 175.3,
            'friendsNames': ['Jim', 'Ryan', 'Todd', 'Stanley', 'Darryl'],
            'enemies': ['Toby']
        }
    }

>>> navigator.navigate(myDict, 'person.name.first')
'Michael'

>>> navigator.navigate(myDict, 'person.friendsNames')
['Jim', 'Ryan', 'Todd', 'Stanley', 'Darryl']

>>> navigator.navigate(myDict, 'person.friendsNames[2]')
'Todd'

>>> navigator.navigate(myDict, 'person.friendsNames[10]')

>>> navigator.navigate(myDict, 'person.friendsNames[10]', default='Dwight')
'Dwight'

>>> navigator.navigate(myDict, 'person.friendsNames[10]', safeNavigation=False)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "testProject/.pyenv/local/lib/python2.7/site-packages/dictionary_navigator/navigator.py", line 35, in navigate
    currentObject = currentObject[index]
IndexError: list index out of range

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dictionary_navigator-1.0.1.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

dictionary_navigator-1.0.1-py2-none-any.whl (7.6 kB view details)

Uploaded Python 2

File details

Details for the file dictionary_navigator-1.0.1.tar.gz.

File metadata

  • Download URL: dictionary_navigator-1.0.1.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.15+

File hashes

Hashes for dictionary_navigator-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0c2053333f8e8ad3738809a14e61d736c194f531b67537fc7b51b13bef823557
MD5 c3d4be2cbe49b1530580821b3b6db575
BLAKE2b-256 3fa96486faf987d6c45393fbd5034c529acb606a6259e89ec3601dbd2889c52a

See more details on using hashes here.

Provenance

File details

Details for the file dictionary_navigator-1.0.1-py2-none-any.whl.

File metadata

  • Download URL: dictionary_navigator-1.0.1-py2-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.15+

File hashes

Hashes for dictionary_navigator-1.0.1-py2-none-any.whl
Algorithm Hash digest
SHA256 932dd10ece0422146ad3d0072f706548350fe47c0d23fa14f764dee8200f8ae3
MD5 b58589e257a61239f0b48e9a5f1e7627
BLAKE2b-256 e8bd96fd17473047147a5b117c7378dc9db3f98e54d81efbe58e4a1d2f9a3eaf

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page