Explore Courses Blog Tutorials Interview Questions
0 votes
in Python by (47.6k points)

Is there a simple way to determine if a variable is a list, dictionary, or something else? I am getting an object back that may be either type and I need to be able to tell the difference.

1 Answer

0 votes
by (106k points)
edited by

To determine the type of an object you can do that using type():-

a = [] 


f = () 


To know more about this you can have a look at the following video tutorial:-

Related questions

+2 votes
3 answers
asked May 24, 2019 in Python by Suresh (3.4k points)
+1 vote
1 answer
+3 votes
2 answers
0 votes
1 answer

Browse Categories