Top "Dictionary" questions

A dictionary maps keys to values allowing efficient retrieval of values by keys.

Proper way to initialize a C# dictionary with values?

I am creating a dictionary in a C# file with the following code: private readonly Dictionary<string, XlFileFormat> …

c# dictionary
Reverse / invert a dictionary mapping

Given a dictionary like so: my_map = {'a': 1, 'b': 2} How can one invert this map to get: inv_map = {1: 'a', 2: …

python dictionary mapping reverse
How to define hash tables in Bash?

What is the equivalent of Python dictionaries but in Bash (should work across OS X and Linux).

bash dictionary hashtable associative-array
How can I use pickle to save a dict?

I have looked through the information that the Python docs give, but I'm still a little confused. Could somebody post …

python dictionary pickle
Declare and initialize a Dictionary in Typescript

Given the following code interface IPerson { firstName: string; lastName: string; } var persons: { [id: string]: IPerson; } = { "p1": { firstName: "F1", lastName: "L1" }, "…

dictionary initialization typescript
Iterating through a JSON object

I am trying to iterate through a JSON object to import data, i.e. title and link. I can't seem …

python dictionary loops
Creating a dictionary from a csv file?

I am trying to create a dictionary from a csv file. The first column of the csv file contains unique …

python csv dictionary list-comprehension
Error: " 'dict' object has no attribute 'iteritems' "

I'm trying to use NetworkX to read a Shapefile and use the function write_shp() to generate the Shapefiles that …

python python-3.x dictionary
How does collections.defaultdict work?

I've read the examples in python docs, but still can't figure out what this method means. Can somebody help? Here …

python dictionary default-value defaultdict
How can I loop through a C++ map of maps?

How can I loop through a std::map in C++? My map is defined as: std::map< std::string, …

c++ loops dictionary iteration idioms