author | Puneeth Chaganti <punchagan@fossee.in> |
Tue, 09 Nov 2010 15:33:47 +0530 | |
changeset 413 | da1f270b07b7 |
parent 398 | 36295bb91766 |
permissions | -rw-r--r-- |
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()|} |