0
Explain various features of a dict datatype in python.
3 Antworten
+ 4
As you have not finished the python tutorial, i would recommend you to do so. on the bottom find 2 links dedicated to dictionary:
>>> To get more info about dict, use console and type:
help(dict) and press return
https://www.sololearn.com/learn/Python/2450/
https://www.sololearn.com/learn/Python/2451/
+ 3
cruid =
create
read
update
insert
delete
+ 2
In Python, there are only a few very popular containers. dict, list, and tuple. A dict is different from a list because you can map any immutable key to any value. A dictionary in Python is similar to c++'s map, Java's HashMap, c#'s Dictionary, and PHP's associative array.
You can do what you'd expect with any key-value pair container.
You can set keys to map to specific values.
mydict = {}
mydict['x'] = 4
mydict['y'] = 5
# you can remove or unset keys.
mydict.pop('y')
A more tutorial-like explanation is at:
https://www.w3schools.com/python/python_dictionaries.asp
The most detail and most trusted source for information about dictionaries is the official documentation at:
https://docs.python.org/3/tutorial/datastructures.html