A module to access Python props using dotpath.
Project description
dotpath
A simple module to access Python props using dotpath.
Example
from dotpath import dotpath
# A object
pets_dic = {
'pets': {
'dog': {
'name': 'Billy',
'age': 5,
'friends': ['Joe', 'Jack'],
},
'cat': {
'name': 'Joe',
'age': 6,
'friends': ['Billy', 'Pop'],
},
},
}
dog_name = getpath(pets_dic, 'pets.dog.name') # Returns Billy
cat_name = getpath(pets_dic, 'pets.cat.name') # Returns Joe
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dotpath-0.1.0.tar.gz
(1.8 kB
view hashes)