Skip to content

Edit python get doc #6747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions content/python/concepts/dictionaries/terms/get/get.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ dictionary.get(key, value)

Where `key` is the key of the value to return and `value` is an optional value to return if `key` does not exist in `dictionary`. If `value` isn't specified, the fallback value will be `None`.

## Additional Examples

### Example: Getting a value safely
```python
user = {"name": "Alex", "age": 30}
print(user.get("email", "Not provided"))
```

## Codebyte Example

The following example creates a dictionary, then retrieves some values for keys using `.get()`:
Expand Down