How to Use Python 3 To Create Well-Designed Scripts


show more Organizing data with dictionaries provides you with in-depth training on Developer. Taught by Bill Weinman as part of the Python 3 Essential Training show less
please wait ...

Organizing data with dictionaries

Dictionaries are Python's version of associative arrays or hashed arrays. Dictionaries are created in a couple of different ways. We can create a dictionary with the curly braces and we can say key value like this. So now, we have a dictionary with those values in it. Actually, an easier way to create dictionaries is with its constructor because this allows you to use the named parameters feature of Python and it's just a whole lot easier to type. So you will see it done this way more often.

We get exactly the same result and see that that type is a class dictionary. Finally, if you want to, you can even initialize one dictionary from another. If I have another dictionary? And so there I have that dictionary. I can say d = dictionary and I can take these definitions from up here, copy those and paste those in, and then I can actually specify that other dictionary with the two asterisk notation and I get a dictionary that has all of that in it.

You can test if a value is in a dic...

Organizing data with dictionaries
Video duration: 4m 56s 6h 36m Beginner

Viewers:

Organizing data with dictionaries provides you with in-depth training on Developer. Taught by Bill Weinman as part of the Python 3 Essential Training

Subjects:
Developer Web
Software:
Python
Author:
please wait ...