Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 4549ebb95ce6c03a946b5c70127ff5c9 > files > 6

python2-twodict-1.2-3.mga7.noarch.rpm

# twodict (Two Way Ordered Dict)
Simple two way ordered dictionary for Python.

See [wiki](https://github.com/MrS0m30n3/twodict/wiki) for more informations.

# INSTALLATION

### Install From Source
1. Download & extract source from [here](https://github.com/MrS0m30n3/twodict/archive/1.2.zip)
2. Change directory into **twodict-1.2/**
3. Run `sudo python setup.py install`

### Install From [Pypi](https://pypi.python.org/pypi/twodict)
1. Run `sudo pip install twodict`

# USAGE
```python
from twodict import TwoWayOrderedDict

tdict = TwoWayOrderedDict()
tdict['a'] = 1
tdict['b'] = 2
tdict['c'] = 3

print(tdict['a'])  # Outputs 1
print(tdict[1])  # Outputs 'a'

del tdict[2]
print(tdict)  # TwoWayOrderedDict([('a', 1), ('c', 3)])
```

# AUTHOR
[Sotiris Papadopoulos](https://twitter.com/MrS0m30n3)

# LICENSE
Unlicense (public domain)