Python dictionary is a built-in type that supports key-value pairs. It's the nearest builtin data structure relative to Java's HashMap.

You can declare a dict with key-value pairs set to values:

streetno = {
    "1": "Sachin Tendulkar",
    "2": "Dravid",
    "3": "Sehwag",
    "4": "Laxman",
    "5": "Kohli"
}

You can also set a key-value mapping after creation:

streetno = {}
streetno["1"] = "Sachin Tendulkar"
print(streetno["1"]) # => "Sachin Tendulkar"

Another way to create a dictionary is with the dict() builtin function, but this only works when your keys are valid identifiers:

streetno = dict(one="Sachin Tendulkar", two="Dravid")
print(streetno["one"]) # => "Sachin Tendulkar"
Answer from Alan on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ hash-map-in-python
Hash Map in Python - GeeksforGeeks
October 25, 2025 - A hash map is a data structure that stores key-value pairs and allows fast access, insertion and deletion of values using keys. Python comes with built-in hash maps called dictionaries (dict).
๐ŸŒ
Developer Zone
warner.hashnode.dev โ€บ what-is-hashmap-in-python
What is hashmap in Python
July 27, 2022 - This tutorial is aimed at beginners on using hashmap and other key based data structures like their syntax: How do we use them, for what are they good, weak points, their graphical side (drawbacks), or output?
๐ŸŒ
Roadmap
roadmap.sh โ€บ python โ€บ hashmap
Hashmaps in Python: Master Implementation and Use Cases
January 28, 2026 - Instead of searching through items with the same input one by one, a hashmap jumps straight to the value you want by using a hash function. A hash function is a mathematical operation that converts a key into a number. This number determines where the value is stored in memory, which explains why lookups are so fast. So instead of scanning every item like you would with a list, Python goes directly to the correct location, ensuring the same output for the same input.
๐ŸŒ
Medium
medium.com โ€บ @philip.smalls86 โ€บ building-a-custom-hashmap-in-python-an-in-depth-look-f477fd2cbea8
Building a Custom HashMap in Python: An In-Depth Look | by Philip Smalls | Medium
October 11, 2024 - Hashmaps (or hash tables) are a key component of computer science, offering an efficient way to store key-value pairs. Their main strength is that they allow for fast lookups, insertions, and deletions by leveraging the power of hashing.
๐ŸŒ
Educative
educative.io โ€บ answers โ€บ what-is-a-hashmap-in-python
What is a HashMap in Python?
In Python, a HashMap is also a dictionary. Itโ€™s used for efficient data storage and retrieval. The mechanism behind HashMaps in Python is storing key-value pairs, and each key is associated with a specific value.
๐ŸŒ
Substack
jakubkrajewski.substack.com โ€บ p โ€บ implementing-a-hash-map-in-python
Implementing a Hash Map in Python: A Clean and Simple Approach
December 26, 2024 - It achieves this efficiency by computing a hash of the key, which is then used to determine the appropriate index in an underlying array (often referred to as a "bucket") where the corresponding value should be stored. This hashing technique ensures that operations can be performed in constant time, on average, making the HashMap a highly efficient structure for many applications. In this article, we'll build a simple hash map implementation in Python from scratch.
Find elsewhere
๐ŸŒ
Quora
quora.com โ€บ Are-Python-dictionaries-like-Java-HashTable-or-HashMap
Are Python dictionaries like Java HashTable or HashMap? - Quora
Answer: A Python dictionary is sort of like a HashMap, but: * dict is untyped, so you need not and cannot specify the key and value types. * dict lacks some of the methods present in Javaโ€™s Map interface like replaceAll. Itโ€™s not possible to specify an initial size or a load factor. * dict co...
๐ŸŒ
FreelancingGig
freelancinggig.com โ€บ home โ€บ what is hashmap in python?
What is HashMap in Python? - Developers, Designers & Freelancers - FreelancingGig
December 16, 2019 - HashMap is mainly the Map which is based on the collection class which is mainly used to store the Key & value pairs, this is denoted like HashMap<Key, Value> and HashMap<K, V>. Such class makes does not any kind of guarantees about the order ...
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_dsa_hashtables.asp
Hash Tables with Python
Python Variables Variable Names Assign Multiple Values Output Variables Global Variables Variable Exercises Code Challenge Python Data Types
๐ŸŒ
Edureka
edureka.co โ€บ blog โ€บ hash-tables-and-hashmaps-in-python
Hash Tables and Hashmaps in Python | Hash Table vs Hashmap | Edureka
November 27, 2024 - Hash Tables and hasmaps in Python are a type of data structures that map keys to their value pairs. They are implemented through dictionaries.
๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ library โ€บ typing.html
typing โ€” Support for type hints
3 weeks ago - Source code: Lib/typing.py This module provides runtime support for type hints. Consider the function below: The function surface_area_of_cube takes an argument expected to be an instance of float,...
๐ŸŒ
Turing
turing.com โ€บ kb โ€บ how-to-use-hashmap-in-python
All You Need to Know About Using Hashmaps in Python
A hashmap is a data structure that maps keys to their respective value pairs. It makes it easy to find values that are associated with their keys. There is no difference between a dictionary and a hashmap.
๐ŸŒ
Boot.dev
boot.dev โ€บ lessons โ€บ f1585e95-a8c5-4643-9aca-1579d7482e90
Learn Data Structures and Algorithms in Python: Hashmaps | Boot.dev
Hashmaps are built on top of arrays (or in the case of ours, a Python list). They use a hash function to convert a "hashable" key into an index in the array.
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_ref_dictionary.asp
Python Dictionary Methods
Python Variables Variable Names Assign Multiple Values Output Variables Global Variables Variable Exercises Code Challenge Python Data Types
๐ŸŒ
Swovo
swovo.com โ€บ blog โ€บ python-hashmap-a-comprehensive-guide-to-hash-tables
Python Hashmap: A Comprehensive Guide to Hash Tables - Swovo
The hashmap, also known as a hash table, is a powerful tool that provides efficient storage and retrieval of data. Hashmaps in Python are implemented through the built-in dictionary data type, which stores key-value pairs.
๐ŸŒ
CodeGym
codegym.cc โ€บ java blog โ€บ learning python โ€บ hashmap in python
HashMap in Python
November 13, 2024 - A HashMap is a data structure that stores key-value pairs. The key is a unique identifier, and the value is the data you want to store. In Python, the dictionary data type is the closest equivalent to a HashMap.
๐ŸŒ
Real Python
realpython.com โ€บ python-hash-table
Build a Hash Table in Python With TDD โ€“ Real Python
December 1, 2023 - Map<String, Integer> phonesByNames = new HashMap<>(); This particular hash table maps strings to integers, for example. However, because arrays arenโ€™t native to Python, youโ€™ll keep using a list instead. As a side effect, your hash table will be able to accept arbitrary data types for both the keys and values, just like Pythonโ€™s dict.
๐ŸŒ
Boot.dev
boot.dev โ€บ lessons โ€บ 5e657fda-81c8-41e1-badd-321a708063f2
Learn Data Structures and Algorithms in Python: Hash Map Review | Boot.dev
Hashmaps are awesome. They are simple to use and have an average computational cost of O(1) for lookup, insertion, and deletion operations. In Python, that means dictionaries. In Go, it means maps. In JavaScript, it means object literals.
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ python-dictionary-how-to-create-a-dict-in-python
Python Dictionary โ€“ How to Create a Dict in Python (Hashmap)
March 1, 2023 - By Shittu Olumide Welcome to this Python article on how to create a dictionary. A dictionary (also called a hashmap in other languages) is an unordered grouping of key-value pairs in Python. Since each value can be accessed by its corresponding ...