I have a dictonary in python how to access the value field

0 votes

I have a dictionary like this

dic={"car":["limo","sedan"]}.

How can I access the sedan value here?

Dec 20, 2018 in Python by Jino
• 5,820 points
• 2,067 views

1 answer to this question.

0 votes

dic={"car":["limo","sedan"]}

print (dic.keys())    <-----------------------Fetch the key "car"

print (dic['car'][0])   <------------------------Fetch limo

print (dic['car'][1])    <------------------------Fetch sedan

answered Dec 20, 2018 by Shuvodip

Related Questions In Python

0 votes
1 answer

How to find the value of a row in a csv file in python?

If you want to find the value ...READ MORE

answered May 20, 2019 in Python by Sanam
• 21,270 views
0 votes
0 answers
–1 vote
2 answers
0 votes
1 answer

I want to download a file from the website by web scraping. Can anyone explain how to do this in jupyter lab (python) with an example?

Hey, Web scraping is a technique to automatically ...READ MORE

answered Apr 7, 2020 in Python by Gitika
• 65,730 points
• 4,381 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi • 8,760 views
0 votes
1 answer

how do i use the enumerate function inside a list?

Enumerate() method adds a counter to an ...READ MORE

answered Nov 16, 2021 in Python by Ruhan Siddiqui
• 7,129 views