+ 1

Does anyone know how to read value from a dictionary file in python using key to search for that value ?

I'm struggling to find help on how to read value from a dictionary file in python not much material on that

28th Jun 2022, 1:45 PM
Edward Marais
Edward Marais - avatar
5 odpowiedzi
+ 5
Edward Marais , here is a link to a sample tutorial from the community section that demonstrates the use of dictionary.get() https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2451/?ref=app
28th Jun 2022, 2:35 PM
Lothar
Lothar - avatar
+ 2
You can use the get method on the dictionary.
28th Jun 2022, 1:58 PM
Justice
Justice - avatar
+ 2
Edward Marais The get method is specifically FOR dictionaries in this instance. You provide the key between the parenthesis and then it will return the value that's associated with said key.
28th Jun 2022, 6:48 PM
Justice
Justice - avatar
+ 1
will the get method work if the data in the file is stored as a dictionary? #please note the file just has: word_meaning = { "house":"place that a entity lives in", "wood":"comes from a tree" }
28th Jun 2022, 6:45 PM
Edward Marais
Edward Marais - avatar
+ 1
I need help can someone just show me on discord or something : Edward_S #5214 this is file handling just note that
28th Jun 2022, 6:51 PM
Edward Marais
Edward Marais - avatar