About 3,300,000 results
Open links in new tab
  1. python - How to print the value of a specific key from a …

    Apr 28, 2024 · To retrieve the value at key: 'kiwi', simply do: fruit['kiwi']. This is the most fundamental way to access the value of a certain key. See the documentation for further …

  2. Print specific key-value pairs of a dictionary in Python

    Apr 9, 2024 · To print specific key-value pairs of a dictionary: Use the dict.items() method to get a view of the dictionary's items. Use a for loop to iterate over the view. Check if each value …

  3. Python Print Dictionary Keys and Values - GeeksforGeeks

    Sep 27, 2024 · In this article, we'll explore different methods to Print Dictionary Keys and Values. Example: Using print () Method. Explanation: In this example, below Python code defines a …

  4. How to get dictionary to print only the desired key and value?

    May 5, 2023 · for key, search in data.items(): print(key) for ingredient in search: item, value = ingredient.split() outcome = int(value) * quantity print(item, outcome)

  5. How to print keys and values of a python dictionary

    Apr 23, 2023 · This is the simplest way to print all key-value pairs of a Python dictionary. With one for loop, we can iterate through the keys of the dictionary one by one and then print the keys …

  6. python - print key and only one value from dictionary - Stack Overflow

    Jan 21, 2018 · in python 3.x you can use: for k,v in std.items(): print(k,v['Uid']) in python 2.x: for k,v in std.iteritems(): print(k,v['Uid']) python 3.x code:

  7. How to print dictionary keys and values in Python | sebhastian

    May 5, 2023 · In Python, using a for loop with a dictionary object returns only the key, so you can access the value in the loop using the traditional dict[key] syntax. This approach is easy to …

  8. Python print key and value - Python: Print Specific Key-Value Pairs

    Jun 25, 2024 · Print key and value python: To print specific dictionary items that satisfy a condition, we can iterate over all dictionary pairs and check the condition for each pair. If the …

  9. Solved: How to Print a Specific Key from a Python Dictionary

    Dec 5, 2024 · When you need to print a specific key name and its corresponding value from a dictionary, there are several methods to accomplish this. Below, I will detail how you can …

  10. Python: Extract single key-value pair of a dictionary in variables

    Apr 16, 2025 · Write a Python program to extract a single key-value pair from a dictionary into variables. Sample Solution-1: Python Code: # Create a dictionary 'd' with a single key-value …

  11. Some results have been removed
Refresh