
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
How to print a value for a given key for Python dictionary?
Python dictionary is collection of key value pairs. Value associated with a certain key is returned by get() method.
>>> D1={'a':11,'b':22,'c':33} >>> D1.get('b') 22
You can also obtain value by using key inside square brackets.
>>> D1['c'] 33
- Related Articles
- How to get a value for a given key from a Python dictionary?
- Python Program to print key value pairs in a dictionary
- How to search Python dictionary for matching key?
- Accessing Key-value in a Python Dictionary
- How to select Python Tuple/Dictionary Values for a given Index?
- Add a key value pair to dictionary in Python
- How to check if a given key already exists in a Python dictionary?
- How to update the value of a key in a dictionary in Python?
- How to remove a key from a python dictionary?
- Python – Find occurrences for each value of a particular key
- How to check for redundant combinations in a Python dictionary?
- Check whether given key already exists in a dictionary in Python
- How to check if a key exists in a Python dictionary?
- How to print a calendar for a month in Python
- How to print calendar for a month in Python?

Advertisements