programming:python:dictionary
                Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| programming:python:dictionary [2022/06/06 06:45] – levor | programming:python:dictionary [2022/06/06 18:29] (current) – levor | ||
|---|---|---|---|
| Line 10: | Line 10: | ||
| |d.clear()|delete all entries| | |d.clear()|delete all entries| | ||
| |d.copy()|returns a (shallow!) copy of the dictionary| | |d.copy()|returns a (shallow!) copy of the dictionary| | ||
| - | |d.get(key, default=None)|returns a value associated with a key. if key not found -> return // | + | |d.get(key, default=None)|returns a value associated with a //key//. if //key// not found -> return // | 
| |d.setdefault(key, | |d.setdefault(key, | ||
| |d.fromkeys(seq, | |d.fromkeys(seq, | ||
| |d.has_key(key)|returns a boolean value: True if key exists, else -> False| | |d.has_key(key)|returns a boolean value: True if key exists, else -> False| | ||
| |d.keys()|returns a list of the keys: [key1, key2, ...]| | |d.keys()|returns a list of the keys: [key1, key2, ...]| | ||
| - | |d.values()|returns | + | |d.values()|returns | 
| |d**.items()**|returns a list of tuples: [(key1, | |d**.items()**|returns a list of tuples: [(key1, | ||
| |d.update(d2)|add all d2 // | |d.update(d2)|add all d2 // | ||
programming/python/dictionary.1654497922.txt.gz · Last modified: 2022/06/06 06:45 by levor
                
                