热线电话:13121318867

登录
2019-03-20 阅读量: 623
python的元类是什么

在Python中,所有东西都有一些与之相关的类型。例如,如果我们有一个具有整数值的变量,那么它的类型是int。你可以使用type()函数获取任何类型的东西。

num = 23

print("Type of num is:", type(num))

lst = [1, 2, 4]

print("Type of lst is:", type(lst))

name = "Atul"

print("Type of name is:", type(name))

输出:

Type of num is: <class 'int'>
Type of lst is: <class 'list'>
Type of name is: <class 'str'>
0.0000
4
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子