PK ;5m@UVŠ ° ° dicts-latest/py-modindex.html
Please activate JavaScript to enable the search functionality.
From here you can search these documents. Enter your search words into the box below and click "search". Note that the search function will automatically search for all of the words. Pages containing fewer words won't appear in the result list.
To install dicts form Pypi:
easy_install dicts
or
pip install dicts
if you want to install it from source code:
python setup.py install
Add dic pairs to self.data
>>> d1 = Dict({1 : 7, 2 : [1,2], 3 : 'a'})
>>> d1.join({1 : 2, 2 : [3], 3 : 'b'})
{1: 9, 2: [1, 2, 3], 3: 'ab'}
Apply ‘callable’ function over all values.
>>> d = Dict({'1' : 1, '2' : 1})
>>> d.map(lambda x: x/3.0)
>>> d
{'1': 0.3333333333333333, '2': 0.3333333333333333}
Create a dict whose keys are the members of the iterable and values are the number of times the key appears in the iterable.
>>> Dict.fromrepetitions([1,1,1,1,2])
{1: 4, 2: 1}
Dictionary lookup with a regular expression. Return pairs whose key matches pattern.
>>> d = Dict({'1' : 1, '2' : 1, 'a' : 10, '11' : 20})
>>> d.relookup('\d+')
[('1', 1), ('2', 1), ('11', 20)]
Dictionary that iterates over its elements.
>>> sd = SortedDict({'c' : (1,'b'), 'a' : (6,'c'), 'b' : (5,'a')}, key=lambda x: x[1][1])
>>> sd.items()
[('b', (5, 'a')), ('c', (1, 'b')), ('a', (6, 'c'))]
Dictionary sorted by key
>>> ksd = KeySortedDict({'c' : 1, 'a' : 6, 'b' : 5})
>>> ksd.items()
[('a', 6), ('b', 5), ('c', 1)]
>>> ksd.keys()
['a', 'b', 'c']
>>> ksd.values()
[6, 5, 1]
Dictionary sorted by value
>>> vsd = ValueSortedDict({'c' : 1, 'a' : 6, 'b' : 5})
>>> vsd.items()
[('c', 1), ('b', 5), ('a', 6)]
>>> vsd.keys()
['c', 'b', 'a']
>>> vsd.values()
[1, 5, 6]