1.python中如何判断一个变量的数据类型?
(1)
import types
a=10
print type(a)
输出>>
<type 'int'>
(2)
import types
a=10
type(x) is types.IntType#判断是否int类型
输出>>
Out[18]: True
(3)
import types
a=10
type(a)==types(1)#判断是否int类型
输出>>
Out[20]: True
1.python中如何判断一个变量的数据类型?
(1)
import types
a=10
print type(a)
输出>>
<type 'int'>
(2)
import types
a=10
type(x) is types.IntType#判断是否int类型
输出>>
Out[18]: True
(3)
import types
a=10
type(a)==types(1)#判断是否int类型
输出>>
Out[20]: True
您可能感兴趣的与本文相关的镜像
Llama Factory
LLaMA Factory 是一个简单易用且高效的大型语言模型(Large Language Model)训练与微调平台。通过 LLaMA Factory,可以在无需编写任何代码的前提下,在本地完成上百种预训练模型的微调
1630
4084
1145
630

被折叠的 条评论
为什么被折叠?