Top "Dictionary" questions

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

Mapping over values in a python dictionary

Given a dictionary { k1: v1, k2: v2 ... } I want to get { k1: f(v1), k2: f(v2) ... } provided I pass …

python dictionary map-function
How to use range-based for() loop with std::map?

The common example for C++11 range-based for() loops is always something simple like this: std::vector<int> numbers = { 1, 2, 3, 4, 5, 6, 7 }; …

c++ c++11 for-loop dictionary
TypeScript Objects as Dictionary types as in C#

I have some JavaScript code that uses objects as dictionaries; for example a 'person' object will hold a some personal …

arrays object dictionary typescript
How to convert a file into a dictionary?

I have a file comprising two columns, i.e., 1 a 2 b 3 c I wish to read this file to a …

python file dictionary
How to pretty print nested dictionaries?

How can I pretty print a dictionary with depth of ~4 in Python? I tried pretty printing with pprint(), but it …

python dictionary
Iterating over all the keys of a map

Is there a way to get a list of all the keys in a Go language map? The number of …

loops dictionary go
The given key was not present in the dictionary. Which key?

Is there a way to get the value of the given key in the following exception in C# in a …

c# exception generics dictionary
Accessing a Dictionary.Keys Key through a numeric index

I'm using a Dictionary<string, int> where the int is a count of the key. Now, I need …

c# .net dictionary
Python "extend" for a dictionary

What is the best way to extend a dictionary with another one while avoiding the use of a for loop? …

python dictionary
Rename a dictionary key

Is there a way to rename a dictionary key, without reassigning its value to a new name and removing the …

python dictionary associative-array ordereddictionary