Python

Python Menu

Python

Python Dictionary get() - Definition, Syntax, Parameters, Examples

Definition

The get() method returns the value of the item with the specified key.

Syntax

dictionary.get(keyname, value)

Parameters

Parameter Description
keyname Required. The keyname of the item you want to return the value from
value Optional. A value to return if the specified key does not exist. Default value None

Examples:

person = { "name": "Raymond", "age": 29, "country": "Japan" } x = person.get("country") print(x)

Introduction

Python Basics

Python Advance

Data Science Python Tutorials

Python Functions and Methods