Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
questions about dict.get
#2
to get the value of a dictionary entry use dictname['key']
like:
>>> dict_1={'ali':12,"mohammad":15,"fatemeh":20}
>>> x = dict_1['fatemeh']
>>> x
20
or just:
>>> dict_1={'ali':12,"mohammad":15,"fatemeh":20}
>>> print(dict_1['ali'])
12
>>>
Reply


Messages In This Thread
questions about dict.get - by akbarza - Apr-19-2024, 06:21 AM
RE: questions about dict.get - by Larz60+ - Apr-19-2024, 08:30 AM
RE: questions about dict.get - by deanhystad - Apr-19-2024, 01:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Questions about elements in dict new_to_python 5 2,229 Feb-08-2020, 02:47 PM
Last Post: new_to_python
  Discord bot that asks questions and based on response answers or asks more questions absinthium 1 45,689 Nov-25-2017, 06:21 AM
Last Post: heiner55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020