dictionaries/quickref.tex
author bhanu
Wed, 10 Nov 2010 23:30:00 +0530
changeset 469 cfe73374e6ca
parent 398 36295bb91766
permissions -rw-r--r--
Language check done for `saving plots`
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
398
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     1
Defining dictionary:\\
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     2
{\ex \lstinline|    d = {'k1':'v1', 'k2':'v2'}|}
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     3
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     4
Access value using key in dictionary:\\
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     5
{\ex \lstinline|    print d['k1']|}
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     6
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     7
Add key-value pair to dictionary:\\
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     8
{\ex \lstinline|    d['k3'] = 'v3'|}
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
     9
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    10
Delete key-value from dictionary:\\
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    11
{\ex \lstinline|    del d['k1']|}
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    12
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    13
Check container-ship of key in dictionary:\\
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    14
{\ex \lstinline|    'k2' in d|}
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    15
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    16
List of keys in dictionary:\\
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    17
{\ex \lstinline|    d.keys()|}
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    18
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    19
List of values in dictionary:\\
36295bb91766 Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
diff changeset
    20
{\ex \lstinline|    d.values()|}