Linux 拨号vps windows公众号手机端

python判断数据类型使用什么函数

lewis 6年前 (2019-03-25) 阅读数 7 #程序编程
文章标签 python

python中使用types函数判断数据类型,具体方法如下:

1.判断是否是int类型

import types #导入types模块

type(x) is types.IntType

2.判断是否是string类型

import types #导入types模块

type(x) is types.StringType

3.判断是否是number类型

import types #导入types模块

type(x) is types.NumberType

版权声明

本文仅代表作者观点,不代表米安网络立场。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

热门