top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

What is use for isinstance() method in python?

0 votes
What is use for isinstance() method in python?
posted Jan 23, 2019 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

The isinstance() function returns True if the specified object is of the specified type, otherwise False.

If the type parameter is a tuple, this function will return True if the object is one of the types in the tuple.


x = isinstance("QueryHome", (str, float, int, str, list, dict, tuple))

print(x) // str
answer Jan 31, 2019 by Aarati Mahajan
Similar Questions
+4 votes

When I try to use numpy to deal with my dataset in the style of csv, I face a problem.

In my dataset of the csv file, some columns are string that can not convert to float easily. Some of them can ignore, but other columns I need to change the data to a enum style.

for example, one column just contain three kinds : S,Q,C. Each of them can declare one meaning, so I must convert them to a dict just like {1,2,3}

Now the question is, when I use numpy.loadtxt, I must do all things above in just one line and one function.

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.