Software: Apache/2.0.54 (Unix) mod_perl/1.99_09 Perl/v5.8.0 mod_ssl/2.0.54 OpenSSL/0.9.7l DAV/2 FrontPage/5.0.2.2635 PHP/4.4.0 mod_gzip/2.0.26.1a uname -a: Linux snow.he.net 4.4.276-v2-mono-1 #1 SMP Wed Jul 21 11:21:17 PDT 2021 i686 uid=99(nobody) gid=98(nobody) groups=98(nobody) Safe-mode: OFF (not secure) /usr/doc/python-2.2.3/html/lib/ drwxr-xr-x | |
| Viewing file: Select action/file-type:
|
| Operation | Result | Notes |
|---|---|---|
len(a) |
the number of items in a | |
a[k] |
the item of a with key k | (1) |
a[k] = v |
set a[k] to v |
|
del a[k] |
remove a[k] from a |
(1) |
a.clear() |
remove all items from a |
|
a.copy() |
a (shallow) copy of a |
|
a.has_key(k) |
1 if a has a key k, else 0 |
|
k |
Equivalent to a.has_key(k) | (2) |
k not in a |
Equivalent to not a.has_key(k) |
(2) |
a.items() |
a copy of a's list of (key, value) pairs | (3) |
a.keys() |
a copy of a's list of keys | (3) |
a.update(b) |
for k in b.keys(): a[k] = b[k] |
|
a.values() |
a copy of a's list of values | (3) |
a.get(k[, x]) |
a[k] if k in a,
else x |
(4) |
a.setdefault(k[, x]) |
a[k] if k in a,
else x (also setting it) |
(5) |
a.popitem() |
remove and return an arbitrary (key, value) pair | (6) |
a.iteritems() |
return an iterator over (key, value) pairs | (2), (3) |
a.iterkeys() |
return an iterator over the mapping's keys | (2), (3) |
a.itervalues() |
return an iterator over the mapping's values | (2), (3) |
Notes:
(value, key) pairs using zip():
"pairs = zip(a.values(), a.keys())". The same
relationship holds for the iterkeys() and
itervalues() methods: "pairs = zip(a.itervalues(),
a.iterkeys())" provides the same value for pairs.
Another way to create the same list is "pairs = [(v, k) for (k,
v) in a.iteritems()]".
None is returned.
See About this document... for information on suggesting changes.
:: Command execute :: | |
--[ c99shell v. 1.0 pre-release build #13 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0044 ]-- |