Type checking in Python

0 votes
How can I check the datatype of a variable in python?
May 8, 2018 in Python by krakken
12 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Use the type() function with the variable whose type is to be checked as the parameter.

>>> i =5
>>> type(i)
'int'
answered May 8, 2018 by Nietzsche's daemon
• 4,260 points

Related Questions In Python

0 votes
1 answer

What's the canonical way to check for type in Python?

To check if o is an instance ...READ MORE

answered Aug 24, 2018 in Python by Priyaj
• 56,100 points
14 views
0 votes
1 answer

How can I change the data type to string in Python?

You can use str(variablename) This is called conversion ...READ MORE

answered Dec 17, 2018 in Python by Shuvodip
36 views
0 votes
1 answer
0 votes
1 answer

How to get base class type in Python?

Yes, There is an alternative. You can ...READ MORE

answered Feb 8 in Python by SDeb
• 9,380 points
7 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
19 views
+4 votes
6 answers
+4 votes
6 answers

Substring search in Python

Use the "in" operator in python" if "substring" ...READ MORE

answered Apr 13, 2018 in Python by Nietzsche's daemon
• 4,260 points
66 views
+4 votes
6 answers

Splitting a List into chunks in Python

Here's a generator that yields the chunks ...READ MORE

answered Apr 13, 2018 in Python by Nietzsche's daemon
• 4,260 points
1,750 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.