Home > Backend Development > Python Tutorial > How to check data type in python

How to check data type in python

藏色散人
Release: 2019-10-02 17:29:59
Original
9702 people have browsed it

How to check data type in python

How to check the data type in python?

In the first step, we first need to know how to check the variable data type in python The type() function is used. The usage of the type function is as shown in the figure below:

How to check data type in python

The second step is to open the py file and enter

import numpy as npa1=123list=[1,2,3,4,5,6]array=np.array(list)print(type(a1))
Copy after login

to print out a1 The data type of the variable is as shown in the figure below:

How to check data type in python

After running the py file in the third step, you can see that the a1 variable is of type int, as shown in the figure below:

How to check data type in python

The fourth step is to enter

print(type(list))print(type(array))
Copy after login

Print out the types of list variables and array variables, as shown below:

How to check data type in python

The fifth step is to run the py file. You can see the list and array types respectively, as shown in the figure below:

How to check data type in python

Recommended: "Python Tutorial

The above is the detailed content of How to check data type in python. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template